project QadFinancials > class BMfgGeneralizedCode > method LoadMfgData

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


icMfgDomaininputcharacterThe MFG/PRO Domain currently being processed. Required when extracting information from MFG/PRO for a table that belons to a domain.
icMfgTableNameinputcharacterName 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.
icFinancialTableNameinputcharacterName of the current financials table being processed, used to determine which logic to execute.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program/bmfggeneralizedcode.p)

<ANCESTOR-CODE>

    /* ====================================================== */
    /* Set the return status to unexpected system error (-98) */
    /* ====================================================== */
    assign oiReturnStatus = -98.
    
    /* ======================================================================== */
    /* Create a query to extract the Domain data from the MFG/PRO database      */
    /* into the objects tlng_mstr temp table that holds the objects data         */
    /* Get the LanguageCode From MFG/PRO that we need to update.              */
    /* ======================================================================== */

    assign vcBusinessKeys = tCodeMstr.code_domain + Chr(2) + tCodeMstr.code_fldname + Chr(2) + tCodeMstr.code_value.
    <M-3 run DataLoad
          (input  '' (icRowids), 
           input  vcBusinessKeys (icPkeys), 
           input  '' (icObjectIds), 
           input  '' (icFreeform), 
           input  true (ilKeepPrevious), 
           output viFcReturnSuper (oiReturnStatus)) in BMfgGeneralizedCode>   
    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 tcode_mstr where 
               tcode_mstr.code_domain = tCodeMstr.code_domain And
               tcode_mstr.code_fldname = tCodeMstr.code_fldname And
               tcode_mstr.code_value = tCodeMstr.code_value No-Error.
    if not available tcode_mstr 
    then do:
         assign
             vcMessageText = trim(substitute(#T-1'The system cannot find the static Logistic record for the replication based on following key: &1':100(60911)t-1#,tCodeMstr.code_domain + ' ' + tCodeMstr.code_fldname + ' ' + tCodeMstr.code_value))
             oiReturnStatus = -3.
         <M-4 run SetMessage
          (input  vcMessageText (icMessage), 
           input  '' (icArguments), 
           input  '' (icFieldName), 
           input  '' (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  '' (icRowid), 
           input  'QadFin-6193':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BMfgGeneralizedCode>         
           Return.
    end. /* if */ 
    assign vcWhereClause = "where code_domain = ":U  + <M-6 EnQuote  (input  tCodeMstr.code_domain (icToQuote)) in BMfgGeneralizedCode>  + " And":U +
                                " code_fldname = ":U + <M-7 EnQuote  (input  tCodeMstr.code_fldname (icToQuote)) in BMfgGeneralizedCode> + " And":U +
                                " code_value = ":U   + <M-8 EnQuote  (input  tCodeMstr.code_value (icToQuote)) in BMfgGeneralizedCode>.
    temp-table tcode_mstr:default-buffer-handle:find-first(vcWhereClause) No-Error.
    if error-status:error
    then do:
         assign
             vcMessageText = trim(substitute(#T-2'The system cannot find the dynamic Logistic record for the replication based on following key: &1':100(60912)t-2#,tCodeMstr.code_domain + ' ' + tCodeMstr.code_fldname + ' ' + tCodeMstr.code_value))
             oiReturnStatus = -3.
         <M-5 run SetMessage
          (input  vcMessageText (icMessage), 
           input  '' (icArguments), 
           input  '' (icFieldName), 
           input  '' (icFieldValue), 
           input  'E':U (icType), 
           input  3 (iiSeverity), 
           input  '' (icRowid), 
           input  'QadFin-6194':U (icFcMsgNumber), 
           input  '' (icFcExplanation), 
           input  '' (icFcIdentification), 
           input  '' (icFcContext), 
           output viFcReturnSuper (oiReturnStatus)) in BMfgGeneralizedCode>  
          Return.
     end. /* if */ 

    /* ====================================================== */
    /* Set the return status = OK                             */
    /* ====================================================== */
    if oiReturnStatus = -98 then
        assign oiReturnStatus = 0.