project QadFinancials > class BPosting > method AdditionalUpdatesBQPosting

Description

Extra method run in additional updates.
This will run an Api-method in BQPosting to create the QPostingLine & QPostingSaf records.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPosting.AdditionalUpdates


program code (program5/bposting.p)

    /* ================================================================================================= */
    /* This method will call a method in BQPosting that will create QPostingLine and QPostingSaf records */
    /* These records will store the delta-amounts that will be used to update the history.               */ 
    /* ================================================================================================= */
    
    /* ====================================================================================================================== */
    /* IMPORTANT NOTE:     AdditionalUpdatesBQPosting                                                                         */
    /* When there only tApiQPostingLine-records and no tApiQPostingLineBank-records then we will not go through the normal    */ 
    /* approach with Starting&Opening the external instance and then call a method in there as that decreases the performance */
    /* If there are no tApiQPostingLineBank-records that need to be processed then we will just create the required           */
    /* QPostingLine and QPostingSaf records in BPosting:PostSave as that will be much faster                                  */
    /* ====================================================================================================================== */
    
    
    
    /* ===================================== */
    /* PART   I: Check for empty temp-tables */
    /* ===================================== */
    if not can-find(first tApiQPostingLineBank)
    then return.
    
    /* ====================================== */
    /* PART II: (Start and) Open the Instance */
    /* ====================================== */
    if viBQPostingPostingID = 0 or
       viBQPostingPostingID = ?
    then do:
        <I-2 {bFcStartAndOpenInstance
             &ADD-TO-TRANSACTION = "true"
             &CLASS              = "BQPosting"}>
    end. /* if viBQPostingPostingID = 0 or */
    else do:
        <I-3 {bFcOpenInstance
             &CLASS           = "BQPosting"}>
    end. /* Not if viBQPostingPostingID = 0 or */
    
    /* ======================================================================================== */
    /* PART III: Run Api-method in BQPosting for bank-GLs (Create & Process)                    */
    /*           Run Api-method in BQPosting to create the QPostingLine and QPostingSaf records */
    /*           When errors occured: Close Instance + Stop External Instances                  */
    /* ======================================================================================== */
    PERFORMBQPOSTINGBLOCKFROMPOSTING: DO:
        if can-find (first tApiQPostingLineBank)
        then do:
            <M-12 run ApiCreateAndProcessQPosting
               (input  tApiQPostingLineBank (tApiQPostingQPostingLine), 
                input  tApiQPostingSafBank (tApiQPostingQPostingSaf), 
                output viFcReturnSuper (oiReturnStatus)) in BQPosting>
            if viFcReturnSuper < 0 or
               oiReturnStatus  = 0
            then assign oiReturnStatus = viFcReturnSuper.
            if oiReturnStatus < 0
            then leave PERFORMBQPOSTINGBLOCKFROMPOSTING.
        end. /* if can-find (first tApiQPostingLineBank) */
    end. /* PERFORMBQPOSTINGBLOCKFROMPOSTING: DO: */
    
    /* ============================ */
    /* PART IV: Close the Instance  */
    /* ============================ */
    /* ========================================================================================================= */
    /* Normally we would here close BQPosting but we will not do it for performance                              */
    /* reasons as this way the Commit of the transaction does not have to re-open the instance to commit it.     */
    /* And in all other scenario's the instance of the class ill be closed by the de-activiate procedure of the  */
    /* appserver that is executed after each call to the appserver                                               */
    /* ========================================================================================================= */
    
    /* Error Handling */
    if oiReturnStatus < 0
    then do:
        <M-19 run StopExternalInstances  (output viFcReturnSuper (oiReturnStatus)) in BPosting>
        return.
    end. /* if oiReturnStatus < 0 */