project QadFinancials > class BAPMatching > method DefaultValuesModifyInitialMatching

Description

DefaultValuesModifyInitialMatching: method that should be called from the UI in case a modify-action is done for an initial mathcing. It will return the list of PO's that are linked to the invoice


Parameters


icAPMatchingTcRowidinputcharacterRowid of the current matching record
iiCInvoiceIDinputintegerID of the CInvoice
tOrderFilterAPMoutputtemp-tableList of PO's that are linked to the invoice.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program7/bapmatching.p)

/* ============================ */
    /* Exception handling           */
    /* Parameter normalisation      */
    /* ============================ */
    empty temp-table tOrderFilterAPM.
    assign oiReturnStatus      = -98
           viLocalReturnStatus = 0.
    if iiCInvoiceID         = ? then assign iiCInvoiceID        = 0.
    if icAPMatchingTcRowid  = ? then assign icAPMatchingTcRowid = "?":U.
    
    /* ============ */
    /* Start Block  */
    /* ============ */
    FILLPOLISTBLOCK: DO :
        
        /* ============================= */
        /* Check the Matching existance  */
        /* ============================= */
        find tAPMatching where 
             tAPMatching.tc_Rowid = icAPMatchingTcRowid
             no-error.
        if not available tAPMatching
        then do :
            assign vcMessage            = trim(substitute(#T-6'Internal error. The system cannot find the matching based upon its row ID (&1).':255(69483)t-6#,icAPMatchingTcRowid))
                   viLocalReturnStatus  = -3.
            <M-1 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8111':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave FILLPOLISTBLOCK.
        end. /* if not available tAPMatching */
        
        /* ============================ */
        /* Check the invoice existance  */
        /* ============================ */
        if iiCInvoiceID = 0
        then do :
            assign vcMessage            = trim(substitute(#T-10'Internal error. Missing elementary information to get the purchase orders linked to the invoice. Invoice ID is zero.':255(69484)t-10#))
                   viLocalReturnStatus  = -3.
            <M-9 run SetMessage
               (input  vcMessage (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  '':U (icRowid), 
                input  'QadFin-8113':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Leave FILLPOLISTBLOCK.
        end. /*if iiCInvoiceID = 0 */
        
        /* ================================================== */
        /* Call query on CInvoicePO to get the matching-scope */
        /* ================================================== */
        <Q-5 run CInvoicePOByCInvoicePO (all) (Read) (NoCache)
           (input iiCInvoiceID, (CInvoiceID)
            input ?, (PODomain)
            input ?, (PONbr)
            output dataset tqCInvoicePOByCInvoicePO) in BCInvoice >
        for each tqCInvoicePOByCInvoicePO : 
            create tOrderFilterAPM.
            assign tOrderFilterAPM.tcPONbr = tqCInvoicePOByCInvoicePO.tcCInvoicePOPoNbr.
        end. /* for each tqCInvoicePOByCInvoicePO */
        
    END. /* FILLPOLISTBLOCK */
    
    /* ============================ */
    /* Exception handling           */
    /* ============================ */
    assign oiReturnStatus = viLocalReturnStatus.