project QadFinancials > class BAPMatching > method AdditionalUpdatesAllLinesDefSafOper

Description

Overtake operational values from result of executed query tqPendingVoucherForMatchingAcc and make new default Operational SAF values. They are stored in tDefaultSafsOperAPM class temporary table.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.AdditionalUpdatesAllLines


program code (program6/bapmatching.p)

/* ======================== */
/* Set default ReturnStatus */
/* ======================== */
assign oiReturnStatus = -98.

empty temp-table tDefaultSafsOperAPM.

/* ============================================================================ */
/* First check whether everything is available what is supposed to be avail     */
/* ============================================================================ */
if not available tAPMatching   or 
   not available tAPMatchingLn or 
   not available tqPendingVoucherForMatchingAcc 
then do :
    assign oiReturnStatus  = -3
           vcMsgAPMatching = trim(substitute(#T-7'Internal error: information that should have been available is not available.':254(999890202)T-7#)) + chr(10) + 
                             trim(substitute(#T-8'Available matching header: &1.':234(49819)T-8#,available (tAPMatching))) + chr(10) + 
                             trim(substitute(#T-9'Available matching details: &1.':234(49820)T-9#,available (tAPMatchingLn))) + chr(10) + 
                             trim(substitute(#T-10'Available pending invoice details: &1.':234(49821)T-10#,available (tqPendingVoucherForMatchingAcc))).
    <M-6 run SetMessage
       (input  vcMsgAPMatching (icMessage), 
        input  '':U (icArguments), 
        input  '':U (icFieldName), 
        input  '':U (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  '':U (icRowid), 
        input  'QadFin-9163':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    Return.
end. /* if not available tAPMatching */
                             
/* Create Operational SAFs */
/* For Logistic charges */
if tAPMatchingLn.APMatchingLnPvodIsLgCharge
then do:
    /* If this is normal purchase receipt -> from ShipTo   *
     * if this is shipment (SO or WO -> from ShipFrom      *
     * Values are assigned in GetPedningVouchersLogCharges */
    if tAPMatchingLn.APMatchingLnPvodSite <> ? and 
       tAPMatchingLn.APMatchingLnPvodSite <> "":U
    then do:
        create tDefaultSafsOperAPM.
        assign tDefaultSafsOperAPM.tcSafConceptCode = {&SAFCONCEPT-SITE}
               tDefaultSafsOperAPM.tcSafCode        = tAPMatchingLn.APMatchingLnPvodSite.
    end.

    /* Supplier Type */
    if tqPendingVoucherForMatchingAcc.tcvd_type <> "":U and
       tqPendingVoucherForMatchingAcc.tcvd_type <> ?
    then do:
        create tDefaultSafsOperAPM.
        assign tDefaultSafsOperAPM.tcSafConceptCode = {&SAFCONCEPT-SUPPLIERTYPE}
               tDefaultSafsOperAPM.tcSafCode        = tqPendingVoucherForMatchingAcc.tcvd_type.
    end. /* if tqPendingVoucherForMatchingAcc.tcvd_type <> "":U or */  
end.

/* for normal receipt of PO Shipper receipt */
else do:
    /* Product Line */                              
    if tqPendingVoucherForMatchingAcc.tcpt_prod_line <> "":U and
       tqPendingVoucherForMatchingAcc.tcpt_prod_line <> ?
    then do:
        create tDefaultSafsOperAPM.
        assign tDefaultSafsOperAPM.tcSafConceptCode = {&SAFCONCEPT-PRODLINE}
               tDefaultSafsOperAPM.tcSafCode = tqPendingVoucherForMatchingAcc.tcpt_prod_line.
    end. /* if tqPendingVoucherForMatchingAcc.tcpt_prod_line <> "":U or */  
    
    /* Site */
    if tqPendingVoucherForMatchingAcc.tcprh_site <> "":U and
       tqPendingVoucherForMatchingAcc.tcprh_site <> ?
    then do:
        create tDefaultSafsOperAPM.
        assign tDefaultSafsOperAPM.tcSafConceptCode = {&SAFCONCEPT-SITE}
               tDefaultSafsOperAPM.tcSafCode = tqPendingVoucherForMatchingAcc.tcprh_site.
    end. /* if tqPendingVoucherForMatchingAcc.tcprh_site <> "":U or */  
    
    /* Item Type */
    if tqPendingVoucherForMatchingAcc.tcpt_part_type <> "":U and
       tqPendingVoucherForMatchingAcc.tcpt_part_type <> ?
    then do:
        create tDefaultSafsOperAPM.
        assign tDefaultSafsOperAPM.tcSafConceptCode = {&SAFCONCEPT-ITEMTYPE}
               tDefaultSafsOperAPM.tcSafCode = tqPendingVoucherForMatchingAcc.tcpt_part_type.
    end. /* if tqPendingVoucherForMatchingAcc.tcpt_part_type <> "":U or */  
    
    /* Item Group */
    if tqPendingVoucherForMatchingAcc.tcpt_group <> "":U and
       tqPendingVoucherForMatchingAcc.tcpt_group <> ?
    then do:
        create tDefaultSafsOperAPM.
        assign tDefaultSafsOperAPM.tcSafConceptCode = {&SAFCONCEPT-ITEMGROUP}
               tDefaultSafsOperAPM.tcSafCode = tqPendingVoucherForMatchingAcc.tcpt_group.
    end. /* if tqPendingVoucherForMatchingAcc.tcpt_group <> "":U or */  
    
    /* Supplier Type */
    if tqPendingVoucherForMatchingAcc.tcvd_type <> "":U and
       tqPendingVoucherForMatchingAcc.tcvd_type <> ?
    then do:
        create tDefaultSafsOperAPM.
        assign tDefaultSafsOperAPM.tcSafConceptCode = {&SAFCONCEPT-SUPPLIERTYPE}
               tDefaultSafsOperAPM.tcSafCode = tqPendingVoucherForMatchingAcc.tcvd_type.
    end. /* if tqPendingVoucherForMatchingAcc.tcvd_type <> "":U or */  
end.

/* ======================== */
/* Set ReturnStatus = OK    */
/* ======================== */
if oiReturnStatus = -98
then assign oiReturnStatus = 0.