Created
March 13, 2020 04:17
-
-
Save vinodronold/bb7f5d2f05b83543fd7b9a22dc4b2a8a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Local Package:Header &oInvoiceHeader = create Package:Header(); | |
Local number &nCnt; | |
Local SQL &sqlHeader, &sqlLine; | |
Local Record &recHeader, &recLine; | |
Local array of Record &arrHeader, &arrLine; | |
&recHeader = CreateRecord(Record.Z_HDR_TAO); | |
&arrHeader = CreateArrayRept(&recHeader, 0); | |
/*** LOAD HEADER ARRAY ***/ | |
MessageBox(0, "", 0, 0, "%1 - Loading Header Array - START", %Datetime); | |
&sqlHeader = CreateSQL("%SelectAll(:1) WHERE PROCESS_INSTANCE = :2 ORDER BY INVOICE_NBR"); | |
&sqlHeader.Execute(&recHeader, Z_HDR_AET.PROCESS_INSTANCE.Value); | |
While &sqlHeader.Fetch(&recHeader) | |
&arrHeader.Push(CreateRecord(Record.Z_HDR_TAO)); | |
&recHeader.CopyFieldsTo(&arrHeader [&arrHeader.Len]) | |
End-While; | |
&sqlHeader.Close(); | |
MessageBox(0, "", 0, 0, "%1 - Loading Header Array - END", %Datetime); | |
/*** GENERATE HEADER FILE ***/ | |
MessageBox(0, "", 0, 0, "%1 - Generating Invoice Header File - START", %Datetime); | |
For &nCnt = 1 To &arrHeader.Len | |
&oInvoiceHeader.InvoiceID = String(&arrHeader [&nCnt].INVOICE_NBR.Value); | |
&oInvoiceHeader.BusinessUnit = String(&arrHeader [&nCnt].BUSINESS_DESCR.Value); | |
&oInvoiceHeader.Source = "SOURCE"; | |
&oInvoiceHeader.InvoiceNumber = String(&arrHeader [&nCnt].INVOICE_NBR.Value); | |
&oInvoiceHeader.InvoiceAmount = String(&arrHeader [&nCnt].DEDUCT_GARN_AMT.Value); | |
&oInvoiceHeader.InvoiceDate = DateTimeToLocalizedString(&arrHeader [&nCnt].PAY_END_DT_ALT.Value, "yyyy/MM/dd"); | |
&oInvoiceHeader.insert(); | |
End-For; | |
&oInvoiceHeader.createFile(); | |
MessageBox(0, "", 0, 0, "%1 - Generating Invoice Header File - END", %Datetime); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment