project QadFinancials > class BAPMatching > method ValidateComponentPreAPMLn2

validation procedure

Description

ValidateComponentPreValidateAPMLn2: submethod of ValidateComponentPreValidate


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BAPMatching.ValidateComponentPre


program code (program4/bapmatching.p)

/* ========================= */
/* Set default return-status */
/* ========================= */
assign oiReturnStatus = -98.

/* ============================= */
/* Check for record-availability */
/* ============================= */
assign vcMsgAPMatching = "":U.
if not available t_sAPMatching 
then assign vcMsgAPMatching = trim(substitute(#T-61'Internal error: no AP matching record is available.':255(56009)T-61#)).
if vcMsgAPMatching = "":U and 
   not available t_sAPMatchingLn 
then assign vcMsgAPMatching = trim(substitute(#T-65'Internal error: no AP matching line record is available.':255(56010)T-65#,string(t_sAPMatching.tiCInvoicePostingYear),t_sAPMatching.tcCInvoiceJournalCode,string(t_sAPMatching.tiCInvoiceVoucher))) .
if vcMsgAPMatching <> "":U
then do:
    assign oiReturnStatus = -1.
    <M-60 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-6840':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  '':U (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    Return.
end. /* if not available t_sAPMatching */

/* ============================================= */
/* Error in case these fields are not yet filled */
/* ============================================= */  
if t_sAPMatchingLn.APMatchingLnPvodIsLgCharge   = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodLgCharge     = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodItemType     = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodExchRate     = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodExchRate2    = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodCCRate       = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodCCScale      = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodReceiptQty   = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodOpenQty      = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodCurrency     = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodIntRef       = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodUoM          = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodOrder        = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodOrderLnNbr   = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodOrderType    = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodSite         = ?      Or 
   t_sAPMatchingLn.APMatchingLnPvodConvFactor   = ?      Or 
   t_sAPMatchingLn.APMatchingLnPvodCompCode     = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodCompID       = ?      Or 
   t_sAPMatchingLn.APMatchingLnPvodCostMtdCur   = ?      Or 
   t_sAPMatchingLn.APMatchingLnPvodCostMtdGL    = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodIsTaxable    = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodSupplier     = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodPayCond      = ?      Or
   t_sAPMatchingLn.APMatchingLnPvodItemType     = "":U   Or
   t_sAPMatchingLn.APMatchingLnPvodExchRate     = 0      Or
   t_sAPMatchingLn.APMatchingLnPvodExchRate2    = 0      Or
   t_sAPMatchingLn.APMatchingLnPvodReceiptQty   = 0      Or
   t_sAPMatchingLn.APMatchingLnPvodOpenQty      = 0      Or
   t_sAPMatchingLn.APMatchingLnPvodCurrency     = "":U   Or
   t_sAPMatchingLn.APMatchingLnPvodIntRef       = "":U   Or
   t_sAPMatchingLn.APMatchingLnPvodOrder        = "":U   Or
   t_sAPMatchingLn.APMatchingLnPvodOrderType    = "":U   Or
   (t_sAPMatchingLn.APMatchingLnPvodOrderLnNbr  = 0      And
    t_sAPMatchingLn.APMatchingLnPvodIsLgCharge  = false) Or 
   t_sAPMatchingLn.APMatchingLnPvodConvFactor   = 0      Or
   t_sAPMatchingLn.APMatchingLnPvodCompCode     = "":U   Or
   t_sAPMatchingLn.APMatchingLnPvodCompID       = 0      Or
   t_sAPMatchingLn.APMatchingLnPvodCostMtdCur   = "":U   Or 
   t_sAPMatchingLn.APMatchingLnPvodCostMtdGL    = "":U   Or
   (t_sAPMatchingLn.APMatchingLnPvodSupplier   = "":U  and 
    t_sAPMatchingLn.APMatchingLnPvodIsLgCharge = false) Or
   (t_sAPMatchingLn.APMatchingLnPvodSite         = "":U and 
    t_sAPMatchingLn.APMatchingLnPvodItemType <> {&APMATCHINGLNPVODITEMTYPE-MEMO}) Or
   (t_sAPMatchingLn.APMatchingLnPvodUoM       = "":U and 
    t_sAPMatchingLn.APMatchingLnPvodItemType <> {&APMATCHINGLNPVODITEMTYPE-MEMO} and 
    t_sAPMatchingLn.APMatchingLnPvodIsLgCharge <> true)  Or
   ((t_sAPMatchingLn.APMatchingLnPvodItem  = "":U or 
     t_sAPMatchingLn.APMatchingLnPvodItem  = ?) and 
    ((t_sAPMatchingLn.APMatchingLnPvodIsLgCharge <> true and
      t_sAPMatchingLn.APMatchingLnPvodItemType   <> {&APMATCHINGLNPVODITEMTYPE-MEMO}) or 
     (t_sAPMatchingLn.APMatchingLnPvodIsLgCharge = true and 
      t_sAPMatchingLn.APMatchingLnPvodOrderType  = {&APMATCHINGLNPVODORDERTYPE-PURCHASE}))) 
then do :
    assign oiReturnStatus      = -1
           vcMsgAPMatching     = trim(substitute(#T-66'The pending invoice related fields on the matching line are mandatory. Pending invoice: &1 / &2.':255(69236)T-66#,string(t_sAPMatchingLn.PvoID),string(t_sAPMatchingLn.PvodLineID)))
           vcMessageContext    = "tAPMatchingLn.APMatchingLnPvodIsLgCharge=":U + (if t_sAPMatchingLn.APMatchingLnPvodIsLgCharge = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodIsLgCharge)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodLgCharge=":U + (if t_sAPMatchingLn.APMatchingLnPvodLgCharge = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodLgCharge)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodItemType=":U + (if t_sAPMatchingLn.APMatchingLnPvodItemType = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodItemType)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodExchRate=":U + (if t_sAPMatchingLn.APMatchingLnPvodExchRate = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodExchRate)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodExchRate2=":U + (if t_sAPMatchingLn.APMatchingLnPvodExchRate2 = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodExchRate2)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodCCRate=":U + (if t_sAPMatchingLn.APMatchingLnPvodCCRate = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodCCRate)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodCCScale=":U + (if t_sAPMatchingLn.APMatchingLnPvodCCScale = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodCCScale)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodReceiptQty=":U + (if t_sAPMatchingLn.APMatchingLnPvodReceiptQty = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodReceiptQty)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodUnitPrice=":U + (if t_sAPMatchingLn.APMatchingLnPvodUnitPrice = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodUnitPrice)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodOpenQty=":U + (if t_sAPMatchingLn.APMatchingLnPvodOpenQty = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodOpenQty)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodOpenAmtTC=":U + (if t_sAPMatchingLn.APMatchingLnPvodOpenAmtTC = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodOpenAmtTC)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodCurrency=":U + (if t_sAPMatchingLn.APMatchingLnPvodCurrency = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodCurrency)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodIntRef=":U + (if t_sAPMatchingLn.APMatchingLnPvodIntRef = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodIntRef)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodItem=":U + (if t_sAPMatchingLn.APMatchingLnPvodItem = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodItem)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodUoM=":U + (if t_sAPMatchingLn.APMatchingLnPvodUoM = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodUoM)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodOrder=":U + (if t_sAPMatchingLn.APMatchingLnPvodOrder = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodOrder)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodOrderLnNbr=":U + (if t_sAPMatchingLn.APMatchingLnPvodOrderLnNbr = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodOrderLnNbr)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodOrderType=":U + (if t_sAPMatchingLn.APMatchingLnPvodOrderType = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodOrderType)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodSite=":U + (if t_sAPMatchingLn.APMatchingLnPvodSite = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodSite)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodConvFactor=":U + (if t_sAPMatchingLn.APMatchingLnPvodConvFactor = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodConvFactor)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodCompCode=":U + (if t_sAPMatchingLn.APMatchingLnPvodCompCode = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodCompCode)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodCompID=":U + (if t_sAPMatchingLn.APMatchingLnPvodCompID = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodCompID)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodCostMtdCur=":U + (if t_sAPMatchingLn.APMatchingLnPvodCostMtdCur = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodCostMtdCur)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodCostMtdGL=":U + (if t_sAPMatchingLn.APMatchingLnPvodCostMtdGL = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodCostMtdGL)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodIsTaxable=":U + (if t_sAPMatchingLn.APMatchingLnPvodIsTaxable = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodIsTaxable)) + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodSupplier=":U + (if t_sAPMatchingLn.APMatchingLnPvodSupplier = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodSupplier))  + chr(2) + 
                                 "tAPMatchingLn.APMatchingLnPvodPayCond=":U + (if t_sAPMatchingLn.APMatchingLnPvodPayCond = ? then "?":U else string(t_sAPMatchingLn.APMatchingLnPvodPayCond)).
    <M-57 run SetMessage
       (input  vcMsgAPMatching (icMessage), 
        input  '':U (icArguments), 
        input  'tAPMatchingLn.APMatchingLnPvodItem':U (icFieldName), 
        input  t_sAPMatchingLn.APMatchingLnPvodItem (icFieldValue), 
        input  'E':U (icType), 
        input  3 (iiSeverity), 
        input  t_sAPMatchingLn.tc_Rowid (icRowid), 
        input  'QadFin-6839':U (icFcMsgNumber), 
        input  '':U (icFcExplanation), 
        input  '':U (icFcIdentification), 
        input  vcMessageContext (icFcContext), 
        output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    Return.
end. /* if */

/* ======================================== */
/* Validate the Operational Allocation Code */
/* ======================================== */
if t_sAPMatchingLn.APMatchingLnOpAllocCode <> '':U and t_sAPMatchingLn.APMatchingLnOpAllocCode <> ?
then do:
    <Q-73 assign vlFcQueryRecordsAvailable = AlMstrByDomainCode (NoCache)
       (input t_sAPMatchingLn.PvoDomain, (Domain)
        input t_sAPMatchingLn.APMatchingLnOpAllocCode, (Code)) in BMfgAllocationAccount>
    if vlFcQueryRecordsAvailable = false
    then do:
        assign vcMsgAPMatching = substitute(#T-68'The Op Allocation Code &1 is not a valid code for domain &2.':255(352224119)T-68#, t_sAPMatchingLn.APMatchingLnOpAllocCode, t_sAPMatchingLn.PvoDomain)
               oiReturnStatus  = -1.
        <M-36 run SetMessage
           (input  vcMsgAPMatching (icMessage), 
            input  '':U (icArguments), 
            input  'tAPMatchingLn.APMatchingLnOpAllocCode':U (icFieldName), 
            input  t_sAPMatchingLn.APMatchingLnOpAllocCode (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  t_sAPMatchingLn.tc_Rowid (icRowid), 
            input  'qadfin-144776':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
    end. /* if vlFcQueryRecordsAvailable = false */
end. /* if t_sAPMatchingLn.APMatchingLnOpAllocCode <> '':U and t_sAPMatchingLn.APMatchingLnOpAllocCode <> ? */

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