Description
Controls the process of loading data from the qaddb database into the business component. This method is part of the Generic MFG/PRO update infrastrcuture.
Parameters
icMfgDomain | input | character | The MFG/PRO Domain currently being processed. Required when extracting information from MFG/PRO for a table that belons to a domain. |
icMfgTableName | input | character | Name of the MFG/PRO table name that is currently being processed. This is used to determine which logic to execute within the method in the cases where one business component maps to multiple tables in MFG/PRO. |
icFinancialTableName | input | character | Name of the current financials table being processed, used to determine which logic to execute. |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program/bmfgcredittermsdetail.p)
<ANCESTOR-CODE>
/* ====================================================== */
/* Set the return status to unexpected system error (-98) */
/* ====================================================== */
assign oiReturnStatus = -98.
/* ======================================================================== */
/* Create a query to extract the payment condition detail sequence from the MFG/PRO database */
/* ======================================================================== */
/* get credit term detail sequence by domain, payment condition code and detail code */
<Q-3 run CreditTermsDetailByDomainCode (all) (Read) (NoCache)
(input vcCreditTermsDetailDomain, (Domain)
input tCopyPaymentConditionStaged.tcPaymentConditionCode, (PaymentConditionCode)
input tCopyPaymentConditionStaged.tcStagedPaymentConditionCode, (StagedPaymentConditionCode)
output dataset tqCreditTermsDetailByDomainCode) in BMfgCreditTermsDetail >
find first tqCreditTermsDetailByDomainCode no-error.
if available tqCreditTermsDetailByDomainCode
then do:
viSequenceNum = tqCreditTermsDetailByDomainCode.tictd_seq.
end.
/* make the icPkeys */
assign vcTableKeys = vcCreditTermsDetailDomain + chr(2)
+ tCopyPaymentConditionStaged.tcPaymentConditionCode + chr(2)
+ string(viSequenceNum).
<M-4 run DataLoad (input '':U (icRowids),
input vcTableKeys (icPkeys),
input '':U (icObjectIds),
input '':U (icFreeform),
input yes (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BMfgCreditTermsDetail>
if viFcReturnSuper <> 0
then assign oiReturnStatus = viFcReturnSuper.
if viFcReturnSuper < 0
then Return.
/* ===================================================================== */
/* Synchronize the static buffer and the buffer handle to ensure that */
/* both are pointing to the same record. First we find the tctd_det */
/* record using the static temp table and then we execute the same */
/* find-first against the temp table buffer handle. */
/* We need to execute both of these queries because the two buffers */
/* do not automatically synchronize when a dynamic/static finds are */
/* executed. */
/* ===================================================================== */
find first tctd_det where
tctd_det.ctd_domain = vcCreditTermsDetailDomain and
tctd_det.ctd_code = tCopyPaymentConditionStaged.tcPaymentConditionCode and
tctd_det.ctd_date_cd = tCopyPaymentConditionStaged.tcStagedPaymentConditionCode
no-error.
if not available tctd_det
then do :
assign vcMessageText = trim(substitute(#T-1'Cannot find the static record for the replication based on the key &1.':255(45624)t-1#, vcCreditTermsDetailDomain + "/":U + tCopyPaymentConditionStaged.tcPaymentConditionCode))
oiReturnStatus = -3.
<M-5 run SetMessage (input vcMessageText (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-5188':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgCreditTermsDetail>
Return.
end. /* if not avail */
assign vcWhereClause = "where ctd_domain = ":U + <M-7 EnQuote (input vcCreditTermsDetailDomain (icToQuote)) in BMfgCreditTermsDetail> +
" and ctd_code = ":U + <M-8 EnQuote (input tCopyPaymentConditionStaged.tcPaymentConditionCode (icToQuote)) in BMfgCreditTermsDetail> +
" and ctd_date_cd = ":U + <M-9 EnQuote (input tCopyPaymentConditionStaged.tcStagedPaymentConditionCode (icToQuote)) in BMfgCreditTermsDetail>.
temp-table tctd_det:default-buffer-handle:find-first(vcWhereClause) no-error.
if error-status:error
then do :
assign vcMessageText = trim(substitute(#T-2'Cannot find the dynamic record for the replication based on the key &1.':255(45625)t-2#, vcCreditTermsDetailDomain + "/":U + tCopyPaymentConditionStaged.tcPaymentConditionCode))
oiReturnStatus = -3.
<M-6 run SetMessage (input vcMessageText (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QadFin-5189':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgCreditTermsDetail>
Return.
end. /* if error-status:error */
/* ====================================================== */
/* Set the return status = OK */
/* ====================================================== */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.