project QadFinancials > class BBankStateImport > method AdditionalUpdates

Description

This empty method allows to do additional updates on class temp-tables after records were received (and validated) from outside, using method SetPublicTables.
You can start instances of other business classes to do those updates.


Parameters


oiReturnStatusoutputinteger


Internal usage


unused


program code (program/bbankstateimport.p)

<ANCESTOR-CODE>

/* ============================================================== */
/* Clear the temp-tables used for the interaction with BBankState */
/* ============================================================== */
empty temp-table tApiBankStateBSI.
empty temp-table tApiBankStateLineBSI.
empty temp-table tApiBankStateAllocBSI.
empty temp-table tApiBankStateAllocCollBSI.

/* ============================================================================================ */
/* Go through all new and updated records                                                       */
/* Note; only a single record can be created/updated at the time; see code in ValidateComponent */
/* ============================================================================================ */
for each tBankStateImport where 
         tBankStateImport.tc_Status = "N":U or 
         tBankStateImport.tc_Status = "C":U :
    
    /* ================= */
    /* File is mandatory */
    /* ================= */
    if not can-find(first tBankStateImportFileContent)
    then do :
        assign oiReturnStatus = -1
               vcMsg          = trim(#T-13'A bank statement import can only be performed based on a file.':255(12340)T-13#) + chr(10) + 
                                trim(substitute(#T-14'Technical information: table '&1' is empty.':255(12339)T-14#,"tBankStateImportFileContent":U)).
        <M-6 run SetMessage (input  vcMsg (icMessage),
                 input  '':U (icArguments),
                 input  '':U (icFieldName),
                 input  '':U (icFieldValue),
                 input  'E':U (icType),
                 input  3 (iiSeverity),
                 input  '':U (icRowid),
                 input  'QADFIN-1703':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BBankStateImport>
        next.
    end. /* if not can-find(first tBankStateImportFileConten) */
    
    /* =================== */
    /* Actions For CODA128 */
    /* =================== */
    case tBankStateImport.BankStateImportType:
        when {&BANKSTATEIMPORTTYPE-CODA128}
        then do :                   
            <M-9 run AdditionalUpdatesCodaStart (output viFcReturnSuper (oiReturnStatus)) in BBankStateImport>
            
            if viFcReturnSuper <> 0 
            then assign oiReturnStatus = viFcReturnSuper.
            if oiReturnStatus < 0 
            then return.
        end. /* {&BANKSTATEIMPORTTYPE-CODA128} */
        when {&BANKSTATEIMPORTTYPE-SWIFTMT940} 
        then do:

            <M-12 run AdditionalUpdatesSwiftStart (output viFcReturnSuper (oiReturnStatus)) in BBankStateImport>

            if viFcReturnSuper <> 0 
            then assign oiReturnStatus = viFcReturnSuper.
            if oiReturnStatus < 0 
            then return.
        end. /* {&BANKSTATEIMPORTTYPE-SWIFTMT940} */
        otherwise do :
            assign oiReturnStatus = -1
                   vcMsg          = trim(substitute(#T-15'Currently only bank statement imports of type &1 are supported.':255(12341)T-15#,{&BANKSTATEIMPORTTYPE-CODA128-TR} + ",":U + {&BANKSTATEIMPORTTYPE-SWIFTMT940-TR} )).
            <M-11 run SetMessage (input  vcMsg (icMessage),
                 input  '':U (icArguments),
                 input  '':U (icFieldName),
                 input  '':U (icFieldValue),
                 input  'E':U (icType),
                 input  3 (iiSeverity),
                 input  '':U (icRowid),
                 input  'QADFIN-2999':U (icFcMsgNumber),
                 input  '' (icFcExplanation),
                 input  '' (icFcIdentification),
                 input  '' (icFcContext),
                 output viFcReturnSuper (oiReturnStatus)) in BBankStateImport>
            next.
        END. /* otherwise */
    end case.            
end. /* for each tBankStateImport where */

/* =================================== */
/* External updates towards BBankState */
/* =================================== */
if can-find (first tApiBankStateBSI)
then do :
    <M-8 run AdditionalUpdatesBankStatement (output viFcReturnSuper (oiReturnStatus)) in BBankStateImport>
    if viFcReturnSuper <> 0 
    then assign oiReturnStatus = viFcReturnSuper.
    if oiReturnStatus < 0 
    then do:
        /* clean up the instance when something goes wrong */
        <M-16 run StopExternalInstances
           (output viFcReturnSuper (oiReturnStatus)) in BBankStateImport>
        return.
    end.
end. /* if can-find (first tApiBankStateBSI) */