Documentation >
MAC-PAC Technical Library >
Distribution >
Synchro >
Programs >
INVOIC Message Extraction - Purpose >
INVOIC Message Extraction - Calculations
INVOIC Message Extraction - Calculations
GA240E
A. Housekeeping
1. In addition to the Reference File categories described in the Common Processing Routines - Housekeeping section, the following records are retrieved from the Reference file (REFERP):
a. VAT surcharge type is retrieved from category 024.
b. VAT information from category 308 is read into an array. All codes are stored except those with VAT type of surcharge.
c. Item types are retrieved from category 405.
d. Category 413 is accessed for the freight item number.
e. The company address is read from G20.
f. The company name is retrieved from category G21.
B. Mainline
1. Depending on the input parameter INPPAR, three different subroutines are called to process invoices:
· INPPAR = 'I': IMMPRC for immediate invoice processing of GA235AP (the CL-program MPMONMENU creates an online job GAIITMON in QINTER)
· INPPAR = 'P': PARPRC for invoice processing of a specific shipment (requested on Synchro Menu)
· INPPAR = 'B': BATPRC for batch invoice processing (requested on Synchro Processing Menu)
At the end of all three subroutines, the statuses of the shipping list headers (NHAVST on GA145M1) are updated to indicate that the INVOIC message request has been processed.
2. Subroutine IMMPRC processes invoices immediately by reading the INVOIC Transmit Request file (GA235AP) and deleting it after the processing. For each record in GA235AP, the Open Item Header Master (AROPENP) is accessed (through logical AROPENL6) to check if the shipment number exists. If found, the INVOIC message is created by calling INVMSG, and the status of the shipping list header (NHAVST on GA145M1) is updated to indicate that the INVOIC message request has been processed.
3. Subroutine PARPRC checks the Open Item Header Master ((AROPENP) through the logical AROPENL6) to see if a record for this shipment number exists, which will be given as an input parameter to this program. If found, INVMSG is called to create the INVOIC message. The status of the shipping list header (NHAVST on GA145M1) is updated to indicate that the INVOIC message request has been processed.
4. Subroutine BATPRC reads all shipping lists headers for which an AVIEXP number has been created (using logical GA145ML9), and chains to the Open Item Header Master (AROPENP using logical AROPNL11) to check if the file includes the current shipment number. If the shipment number is found, an INVOIC message is created by calling INVMSG. The shipping list header status (NHAVST on GA145M1) is updated after each message generation.
5. INVMSG generates the different segments of an INVOIC message and writes the output to the message workfile GA240AP (by calling IOINV) to be processed by the translation package.
6. If any error occurs during processing, a record is written to the error file GA999AP (ERRPRC).