Description
Create Supplier Invoice and APMatchng based on incomming data stored in imput temporary tables.
Parameters
tCInvoiceRef | input-output | temp-table | |
tCInvoicePORef | input | temp-table | |
tAPMatchingLnRef | input-output | temp-table | |
tAPMatchingCostRef | input-output | temp-table | Temp-table to pass additional posting lines. |
tAPMatchingCostSafRef | input-output | temp-table | Pass the safs for the Additional posting lines in tAPMatchingCostRef. |
ilIsAllInvoicesInOneTrans | input | logical | Should be all invoices created in one database transaction? |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
QadFinancials
program code (program6/bcinvoiceapmatching.p)
/* =================================================================================================== */
/* Method : CreateCInvoiceAPMatching */
/* Desc : This method create Supplier Invoice and Receiver Matching (optional) based on data */
/* stored in incomming termporary table */
/* --------------------------------------------------------------------------------------------------- */
/* Params: (I) tCInvoiceRef Supplier Invoice definition */
/* (I) tCInvoicePORef List of purchase orders linked to supplier invoice */
/* (I) tAPMatchingLnRef Matching line details */
/* (I) ilIsAllInvoicesInOneTrans Create all invoices in one database transaction */
/* =================================================================================================== */
assign oiReturnStatus = -98
viLocalReturn = 0.
/* =================================================================================================== */
/* Start processing of the invoices/ap matchings based in incomming data */
/* =================================================================================================== */
MAIN_BLOCK:
do on error undo, return:
/* =================================================================================== */
/* Create invoices in one transaction - this is needed for ERS processing for instance */
/* =================================================================================== */
if ilIsAllInvoicesInOneTrans
then do:
<M-58 run CreateCInvoiceAPMatchingAllInOneTran
(input-output tCInvoiceRef (tCInvoiceRef),
input tCInvoicePORef (tCInvoicePORef),
input-output tAPMatchingLnRef (tAPMatchingLnRef),
output viFcReturnSuper (oiReturnStatus)) in BCInvoiceAPMatching>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave MAIN_BLOCK.
end.
/* ============================================================================== */
/* Create invoices one by one - this is suitable for large volume data processing */
/* ============================================================================== */
else do:
<M-35 run CreateCInvoiceAPMatchingOneInOneTran
(input-output tCInvoiceRef (tCInvoiceRef),
input tCInvoicePORef (tCInvoicePORef),
input-output tAPMatchingLnRef (tAPMatchingLnRef),
output viFcReturnSuper (oiReturnStatus)) in BCInvoiceAPMatching>
if viFcReturnSuper < 0 or viFcReturnSuper > 0 and viLocalReturn = 0 then assign viLocalReturn = viFcReturnSuper.
if viFcReturnSuper < 0 then leave MAIN_BLOCK.
end.
end. /* MAIN_BLOCK */
/* =================================================================================================== */
/* Return */
/* =================================================================================================== */
assign oiReturnStatus = viLocalReturn.