Description
Actions to take after writing current instance to the database, and before final commit of the transaction.
Use the field tc_status to test the status of the updated records:
'' = unchanged
'N' = new
'C' = changed
'D' = deleted
Parameters
oiReturnStatus | output | integer | |
Internal usage
unused
program code (program/bapmatching.p)
<ANCESTOR-CODE>
/* ====================================== */
/* Return in case the ancestor had errors */
/* ====================================== */
if oiReturnStatus < 0 then return.
/* ====================================== */
/* Exception handling */
/* ====================================== */
assign viLocalReturnStatus = oiReturnStatus /* can only be postive or zero */
oiReturnStatus = -98.
/* ===================================================================================== */
/* Perform update of operational data related to save of receiver matching */
/* ===================================================================================== */
OPER_BLOCK: DO :
/* Get default language */
<Q-1 run System (all) (Read) (NoCache)
(input ?, (LanguageID)
output dataset tqSystem) in BSystem >
find first tqSystem no-error.
if not available tqSystem
then do:
<M-11 run SetMessage
(input #T-11'The system definition is missing.':255(69042)T-11# (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input '':U (icType),
input 'E':U (iiSeverity),
input 3 (icRowid),
input 'QadFin-8106':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
assign viLocalReturnStatus = -1.
leave OPER_BLOCK.
end. /* if not available tqSystem */
if vlMatchingDomainIsConsecutNr
then do:
for each tAPMatching where
tAPMatching.tlCInvoiceIsInitialStatus = true and
tAPMatching.APMatchingStatus <> {&APMATCHINGSTATUS-INITIAL}:
<Q-8 run CInvoiceByID (all) (Read) (NoCache)
(input viCompanyId, (CompanyId)
input tAPMatching.CInvoice_ID, (CInvoiceID)
output dataset tqCInvoiceByID) in BCInvoice>
find tqCInvoiceByID where
tqCInvoiceByID.tiCInvoice_ID = tAPMatching.CInvoice_ID
no-lock no-error.
if available tqCInvoiceByID
then assign tAPMatching.tiCInvoiceVoucher = tqCInvoiceByID.tiCInvoiceVoucher.
end. /* for each tAPMatching */
end.
/*To check the MajorVersion and MinorVersion: This is used in apmatching.p*/
if viMfgProMajorVersionBAPM > 3 /* Meaning eB3 */ or
(viMfgProMajorVersionBAPM = 3 /* Meaning eB3 */ and
viMfgProMinorVersionBAPM >= 7 /* Meaning SP7 */)
then assign vlIsLegalDocVersion = true.
/* Open journal entry component as the operationals will look in the instance to find certain data */
if viBJournalEntryAPMID <> 0 and
viBJournalEntryAPMID <> ? and
not valid-handle(vhBJournalEntryAPMInst)
then do:
<I-3 {bFcOpenInstance
&CLASS = "BJournalEntry"}>
end. /* if viBJournalEntryAPMID <> 0 and */
/* Run operational .p-file persistent and run procedure in it */
<M-6 run AddAdditionalInfoInCTLOG
(input 'START' (icTrace),
input 'program=prog/apmatching.p' (icParam1),
input 'method=UpdateOperationalData' (icParam2),
input ? (icParam3),
input ? (icParam4),
input ? (icParam5),
input ? (icParam6),
input ? (icParam7),
input ? (icParam8),
input ? (icParam9)) in BAPMatching>
assign vdDuration = etime.
run prog/apmatching.p persistent set vhAPMatchingProgram
(INPUT {&TARGETPROCEDURE},
INPUT vhBJournalEntryAPMInst,
INPUT vcDomainCode,
INPUT viDomainID,
INPUT vcUserLogin,
INPUT tqSystem.tcLngCode).
run UpdateOperationalData in vhAPMatchingProgram
(INPUT table tAPMatching BIND,
INPUT table tAPMatchingLn BIND,
INPUT table t_iAPMatching BIND,
INPUT table t_iAPMatchingLn BIND,
INPUT table tAPMatchingLnTax BIND,
INPUT vlIsLegalDocVersion,
OUTPUT viFcReturnSuper).
assign vdDuration = etime - vdDuration.
<M-84 run AddAdditionalInfoInCTLOG
(input 'END' (icTrace),
input 'program=prog/apmatching.p' (icParam1),
input 'method=UpdateOperationalData' (icParam2),
input 'Duration=' + string (vdduration) (icParam3),
input ? (icParam4),
input ? (icParam5),
input ? (icParam6),
input ? (icParam7),
input ? (icParam8),
input ? (icParam9)) in BAPMatching>
if viFcReturnSuper <> 0 then assign viLocalReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0 then leave OPER_BLOCK.
end. /* of OPER_BLOCK: */
/* ============================================ */
/* Stop all instances and persistent procedures */
/* ============================================ */
if valid-handle(vhAPMatchingProgram)
then delete procedure vhAPMatchingProgram.
if valid-handle(vhBJournalEntryAPMInst)
then do:
<I-4 {bFcCloseInstance
&CLASS = "BJournalEntry"}>
end. /* if valid-handle(vhBJournalEntryAPMInst) */
/* ================== */
/* Exception handling */
/* ================== */
assign oiReturnStatus = viLocalReturnStatus.