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/bmfgproject.p)
<ANCESTOR-CODE>
/* ====================================================== */
/* Set the return status to unexpected system error (-98) */
/* ====================================================== */
assign oiReturnStatus = -98.
/* ======================================================================== */
/* Create a query to extract the cost center data from the MFG/PRO database */
/* into the objects tcc_mstr temp table that holds the objects data */
/* Get the CostCentreCode From MFG/PRO that we need to update. */
/* ======================================================================== */
assign vcTableKeys = icMfgDomain + chr(2) + tCopyProject.ProjectCode.
<M-2 run DataLoad (input '' (icRowids),
input vcTableKeys (icPkeys),
input '' (icObjectIds),
input '' (icFreeform),
input true (ilKeepPrevious),
output viFcReturnSuper (oiReturnStatus)) in BMfgProject>
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 tcc_mstr */
/* 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 tpj_mstr where
tpj_mstr.pj_domain = icMfgDomain and
tpj_mstr.pj_project = tCopyProject.ProjectCode
no-error.
if not available tpj_mstr
then do :
assign vcMessageText = trim(substitute(#T-3'Cannot find the static record for the replication based on the key &1.':255(45624)t-3#, icMfgDomain + "/":U + tCopyProject.ProjectCode))
oiReturnStatus = -3.
<M-4 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-5047':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgProject>
Return.
end. /* if not avail */
assign vcWhereClause = "where pj_domain = ":U + <M-7 EnQuote (input icMfgDomain (icToQuote)) in BMfgProject> +
" and pj_project = ":U + <M-8 EnQuote (input tCopyProject.ProjectCode (icToQuote)) in BMfgProject>.
temp-table tpj_mstr:default-buffer-handle:find-first(vcWhereClause) no-error.
if error-status:error
then do :
assign vcMessageText = trim(substitute(#T-6'Cannot find the dynamic record for the replication based on the key &1.':255(45692)t-6#, icMfgDomain + "/":U + tCopyProject.ProjectCode))
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-5048':U (icFcMsgNumber),
input '':U (icFcExplanation),
input '':U (icFcIdentification),
input '':U (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BMfgProject>
Return.
end. /* if not avail */
/* ====================================================== */
/* Set the return status = OK */
/* ====================================================== */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.