project QadFinancials > class BAPMatching > method ValidateComponentPreAPM

Description

ValidateComponentPreValidateAPM: 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 */
    /* ============================= */
    if not available t_sAPMatching
    then do :
        assign oiReturnStatus      = -1
               vcMsgAPMatching     = trim(substitute(#T-8'Internal error: no AP matching record is available.':255(56009)T-8#)).
        <M-7 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-5610':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  '':U (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        Return.
    end. /* if not available t_sAPMatching */
    
    /* ================================================================================================================ */
    /* Update supplier invoice amount and update taxes. This is usefull, when receiver mathing was not created from     */
    /* User Interface, but was created automatically from other programs (like ERS)                                     */
    /* ================================================================================================================ */
    if t_sAPMatching.tlIsUpdateCInvoiceAutomatically = true
    then do:
        <M-14 run ValidateComponentPreAPMCInvoice  (output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper <  0
        then do:
            assign vcMsgAPMatching = #T-15'There were errors during update of amount and taxes of supplier invoice from receiver matching.':255(70396)T-15#.
            <M-16 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  '':U (icFieldName), 
                input  '':U (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sAPMatching.tc_Rowid (icRowid), 
                input  'QadFin-8439':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            assign oiReturnStatus = -1.
            return.
        end. /* if viFcReturnSuper <  0 */
    end. /* if t_sAPMatching.tlIsUpdateCInvoiceAutomatically */

    /* ================================================================================================================ */
    /* Fill in the Read-only RKBF of CInvoice_ID in case they are all unknown and the updatbale RKBF are filled         */
    /* This is done here as from this point onwards we expect these fields to be filled but we can hardly expect all    */
    /* callers (like external parties) to provide us all detail information on an invoice. They should thus simply      */
    /* provide unknown values for these detail-fields and provide correct information for the key-fields of the invoice */
    /* ================================================================================================================ */
    assign vlCInvoiceDataUpdated = false.
    if /* Upd */
       ((t_sAPMatching.tiCInvoicePostingYear <> 0     and 
         t_sAPMatching.tiCInvoicePostingYear <> ?     and 
         t_sAPMatching.tcCInvoiceJournalCode <> "":U  and 
         t_sAPMatching.tcCInvoiceJournalCode <> ?     and 
         t_sAPMatching.tiCInvoiceVoucher     <> 0     and
         t_sAPMatching.tiCInvoiceVoucher     <> ?)    or
        (t_sAPMatching.tiCInvoiceRegistrationNr <> 0  and 
         t_sAPMatching.tiCInvoiceRegistrationNr <> ?))   or
       /* Ron */
       (t_sAPMatching.tcCInvoiceReference            = ? or
        t_sAPMatching.tcBusinessRelationCode         = ? or
        t_sAPMatching.tcBusinessRelationICCode       = ? or
        t_sAPMatching.tcCreditorCode                 = ? or 
        t_sAPMatching.tdCInvoiceExchangeRate         = ? or 
        t_sAPMatching.tdCinvoiceRateScale            = ? or
        t_sAPMatching.tdCInvoiceCCRate               = ? or 
        t_sAPMatching.tdCInvoiceCCScale              = ? or 
        t_sAPMatching.tdCInvoiceLCCCRate             = ? or 
        t_sAPMatching.tdCInvoiceLCCCScale            = ? or 
        t_sAPMatching.ttCInvoiceDate                 = ? or 
        t_sAPMatching.ttCInvoicePostingDate          = ? or 
        t_sAPMatching.APMatchingCInvoiceDiscPct      = ? or 
        t_sAPMatching.APMatchingARRecTaxTC           = ? or
        t_sAPMatching.APMatchingARNRecTaxTC          = ? or                                   
        t_sAPMatching.APMatchingAIRecTaxTC           = ? or
        t_sAPMatching.APMatchingAINRecTaxTC          = ? or                                   
        t_sAPMatching.APMatchingTotalAmountTC        = ? or
        t_sAPMatching.APMatchingTotalAmountLC        = ? or 
        t_sAPMatching.ttCInvoiceTaxPointDate         = ? or
        t_sAPMatching.tcCInvoiceType                 = ? or
        t_sAPMatching.tcCInvoicePaymentConditionCode = ? or
        t_sAPMatching.tlCInvoiceIsInitialStatus      = ? or  
        t_sAPMatching.tlCreditorAddrIsEUCountry      = ? or
        t_sAPMatching.tlCreditorAddrIsTaxInCity      = ? or
        t_sAPMatching.tcCreditorAddrCountryCode      = ? or
        t_sAPMatching.tlShipToAddrIsEUCountry        = ? or
        t_sAPMatching.tlShipToAddrIsTaxInCity        = ? or
        t_sAPMatching.tcShipToAddrCountryCode        = ?)
    then do :            
        /* Execute the query */
        <Q-2 run CInvoiceForAPMSelection (all) (Read) (NoCache)
           (input t_sAPMatching.Company_ID, (CompanyId)
            input t_sAPMatching.tiCInvoicePostingYear, (CInvoicePostingYear)
            input t_sAPMatching.tcCInvoiceJournalCode, (JournalCode)
            input t_sAPMatching.tiCInvoiceVoucher, (CInvoiceVoucher)
            input ?, (CInvoiceId)
            input ?, (CreditorCode)
            input ?, (CInvoiceReference)
            input {&ADDRESSTYPECODESYSTEM-HEADOFFICE}, (AddressTypeCode)
            input t_sAPMatching.tiCInvoiceRegistrationNr, (CInvoiceRegistrationNr)
            output dataset tqCInvoiceForAPMSelection) in BCInvoice>
        find tqCInvoiceForAPMSelection where
             tqCInvoiceForAPMSelection.tiCInvoiceRegistrationNr <> t_sAPMatching.tiCInvoiceRegistrationNr or 
             (tqCInvoiceForAPMSelection.tiCompany_ID          = t_sAPMatching.Company_ID            and 
              tqCInvoiceForAPMSelection.tiCInvoicePostingYear = t_sAPMatching.tiCInvoicePostingYear and
              tqCInvoiceForAPMSelection.tcJournalCode         = t_sAPMatching.tcCInvoiceJournalCode and
              tqCInvoiceForAPMSelection.tiCInvoiceVoucher     = t_sAPMatching.tiCInvoiceVoucher)
             no-error.
        if not available tqCInvoiceForAPMSelection
        then do:
            assign oiReturnStatus      = -1
                   vcMsgAPMatching     = trim(substitute(#T-4'The system cannot find the invoice specified in the header based on the GL calendar year (&1), daybook (&2), voucher (&3), and its registration number (&4).':255(69211)T-4#,string(t_sAPMatching.tiCInvoicePostingYear),t_sAPMatching.tcCInvoiceJournalCode,string(t_sAPMatching.tiCInvoiceVoucher),string(t_sAPMatching.tiCInvoiceRegistrationNr))) + chr(10) + 
                                         trim(substitute(#T-5'Cannot  default all invoice related fields':241(55877)T-5#))  + chr(10) + 
                                         trim(substitute(#T-6'Entity ID: &1.':213(999890412)T-6#,string(t_sAPMatching.Company_ID))).
            <M-3 run SetMessage
               (input  vcMsgAPMatching (icMessage), 
                input  '':U (icArguments), 
                input  'tAPMatching.tiCInvoiceVoucher':U (icFieldName), 
                input  string(t_sAPMatching.tiCInvoiceVoucher) (icFieldValue), 
                input  'E':U (icType), 
                input  3 (iiSeverity), 
                input  t_sAPMatching.tc_Rowid (icRowid), 
                input  'QadFin-5609':U (icFcMsgNumber), 
                input  '':U (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            Return.
        end. /* if not available tqCInvoiceForAPMSelection */
        /* Assign the normal ci-depending fields */
        assign t_sAPMatching.tiCInvoiceRegistrationNr       = tqCInvoiceForAPMSelection.tiCInvoiceRegistrationNr 
               t_sAPMatching.tiCInvoicePostingYear          = tqCInvoiceForAPMSelection.tiCInvoicePostingYear
               t_sAPMatching.tcCInvoiceJournalCode          = tqCInvoiceForAPMSelection.tcJournalCode
               t_sAPMatching.tiCInvoiceVoucher              = tqCInvoiceForAPMSelection.tiCInvoiceVoucher   
               t_sAPMatching.tcCurrencyCode                 = tqCInvoiceForAPMSelection.tcCurrencyCode
               t_sAPMatching.tcCInvoiceReference            = tqCInvoiceForAPMSelection.tcCInvoiceReference
               t_sAPMatching.tcBusinessRelationCode         = tqCInvoiceForAPMSelection.tcBusinessRelationCode
               t_sAPMatching.tcBusinessRelationICCode       = tqCInvoiceForAPMSelection.tcBusinessRelationICCode
               t_sAPMatching.tcCreditorCode                 = tqCInvoiceForAPMSelection.tcCreditorCode
               t_sAPMatching.tdCInvoiceExchangeRate         = tqCInvoiceForAPMSelection.tdCInvoiceExchangeRate
               t_sAPMatching.tdCinvoiceRateScale            = tqCInvoiceForAPMSelection.tdCInvoiceRateScale
               t_sAPMatching.tdCInvoiceCCRate               = tqCInvoiceForAPMSelection.tdCInvoiceCCRate
               t_sAPMatching.tdCInvoiceCCScale              = tqCInvoiceForAPMSelection.tdCInvoiceCCScale
               t_sAPMatching.ttCInvoiceDate                 = tqCInvoiceForAPMSelection.ttCInvoiceDate
               t_sAPMatching.ttCInvoicePostingDate          = tqCInvoiceForAPMSelection.ttCInvoicePostingDate
               t_sAPMatching.ttCInvoiceTaxPointDate         = tqCInvoiceForAPMSelection.ttCInvoiceTaxPointDate
               t_sAPMatching.tcCInvoiceType                 = tqCInvoiceForAPMSelection.tcCInvoiceType
               t_sAPMatching.tcCInvoicePaymentConditionCode = tqCInvoiceForAPMSelection.tcPaymentConditionCode
               t_sAPMatching.tlCInvoiceIsInitialStatus      = tqCInvoiceForAPMSelection.tlCInvoiceIsInitialStatus
               t_sAPMatching.tcCreditorAddrTaxIDFederal     = tqCInvoiceForAPMSelection.tcCreditorAddrTaxIDFederal
               t_sAPMatching.tcCreditorAddrTaxIDState       = tqCInvoiceForAPMSelection.tcCreditorAddrTaxIDState
               t_sAPMatching.tcCreditorAddrTaxIDMisc1       = tqCInvoiceForAPMSelection.tcCreditorAddrTaxIDMisc1
               t_sAPMatching.tcCreditorAddrTaxIDMisc2       = tqCInvoiceForAPMSelection.tcCreditorAddrTaxIDMisc2
               t_sAPMatching.tcCreditorAddrTaxIDMisc3       = tqCInvoiceForAPMSelection.tcCreditorAddrTaxIDMisc3
               t_sAPMatching.tlCreditorAddrIsTaxInCity      = tqCInvoiceForAPMSelection.tlCreditorAddrTaxInCity
               t_sAPMatching.tlCreditorAddrIsEUCountry      = tqCInvoiceForAPMSelection.tlCreditorAddrIsEUCountry
               t_sAPMatching.tcCreditorAddrCountryCode      = tqCInvoiceForAPMSelection.tcCreditorAddrCountryCode
               t_sAPMatching.tiCreditorAddr_ID              = tqCInvoiceForAPMSelection.tiCreditorAddr_ID
               t_sAPMatching.tcShipToAddrTaxIDFederal       = tqCInvoiceForAPMSelection.tcShipToAddrTaxIDFederal
               t_sAPMatching.tcShipToAddrTaxIDState         = tqCInvoiceForAPMSelection.tcShipToAddrTaxIDState
               t_sAPMatching.tcShipToAddrTaxIDMisc1         = tqCInvoiceForAPMSelection.tcShipToAddrTaxIDMisc1
               t_sAPMatching.tcShipToAddrTaxIDMisc2         = tqCInvoiceForAPMSelection.tcShipToAddrTaxIDMisc2
               t_sAPMatching.tcShipToAddrTaxIDMisc3         = tqCInvoiceForAPMSelection.tcShipToAddrTaxIDMisc3
               t_sAPMatching.tiShipToAddrTaxDeclaration     = tqCInvoiceForAPMSelection.tiShipToAddrTaxDeclarat
               t_sAPMatching.tlShipToAddrIsTaxInCity        = tqCInvoiceForAPMSelection.tlShipToAddrIsTaxInCity
               t_sAPMatching.tlShipToAddrIsEUCountry        = tqCInvoiceForAPMSelection.tlShipToAddrIsEUCountry
               t_sAPMatching.tcShipToAddrCountryCode        = tqCInvoiceForAPMSelection.tcShipToAddrCountryCode
               t_sAPMatching.tc_Status                      = (if t_sAPMatching.tc_Status = "":U then "C":U else t_sAPMatching.tc_Status)
               vlCInvoiceDataUpdated                        = true.
        /* Fields APMatching.tdCInvoiceLCCCRate and APMatching.tdCInvoiceLCCCScale represent the rate and scale between LC and SC    */
        /* at the moment of the invoice (type: Statutory - optional: accounting) but these fields are not stored on the CInvoice as  */
        /* we do not need that information on the invoice itself. But; the pvod use this value to assign the CC-amounts based upon   */
        /* the LC-amounts in the PO-receipt-posting and we store that rate here to be able to compare the values                     */  
        if viCompanyCCId = viCompanyLCId
        then assign t_sAPMatching.tdCInvoiceLCCCRate  = 1
                    t_sAPMatching.tdCInvoiceLCCCScale = 1.
        else do :
            <M-35 run GetExchangeRate
               (input  t_sAPMatching.Company_ID (iiCompanyID), 
                input  viCompanyLCId (iiFromCurrencyID), 
                input  ? (icFromCurrencyCode), 
                input  viCompanyCCId (iiToCurrencyID), 
                input  ? (icToCurrencyCode), 
                input  ? (iiExchangeRateTypeID), 
                input  {&EXCHANGERATETYPE-STATUTORY} (icExchangeRateTypeCode), 
                input  t_sAPMatching.ttCInvoicePostingDate (itValidityDate), 
                output t_sAPMatching.tdCInvoiceLCCCRate (odExchangeRate), 
                output t_sAPMatching.tdCInvoiceLCCCScale (odExchangeScaleFactor), 
                output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
            if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
            if viFcReturnSuper < 0 then Return.
        end. /* not if viCompanyCCId = viCompanyLCId */
    end. /* if t_sAPMatching.tiCInvoicePostingYear <> 0     and */
    if vlCInvoiceDataUpdated or
       t_sAPMatching.tlIsUpdateCInvoiceAutomatically
    then do:
        /* Assign the Tax-information fields */
        <M-13 run DefaultValuesInvoiceAmount
           (input  t_sAPMatching.CInvoice_ID (iiCInvoiceID), 
            input  t_sAPMatching.APMatching_ID (iiAPMatchingID), 
            input  ? (iiOldReasonID), 
            input-output t_sAPMatching.Reason_ID (biNewReasonID), 
            input-output t_sAPMatching.tcReasonCode (bcNewReasonCode), 
            output vcDummy (ocCurrency), 
            output t_sAPMatching.APMatchingTotalAmountTC (odAmountToMatchTC), 
            output t_sAPMatching.APMatchingTotalAmountLC (odAmountToMatchLC), 
            output t_sAPMatching.APMatchingARRecTaxTC (odTaxAcrueReceiptRecovTC), 
            output t_sAPMatching.APMatchingARNRecTaxTC (odTaxAcrueReceiptNonRecovTC), 
            output t_sAPMatching.APMatchingAIRecTaxTC (odTaxAcrueInvoiceRecovTC), 
            output t_sAPMatching.APMatchingAINRecTaxTC (odTaxAcrueInvoiceNonRecovTC), 
            output t_sAPMatching.APMatchingCInvoiceDiscPct (odInvoiceDiscountPercentage), 
            input  false (ilBCInvoiceIsAlreadyOpen), 
            output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        /* Ignore errors here as they will be tackled later on */
    end. /* if vlCInvoiceDataUpdated or */
    
    /* ============================================= */
    /* Error in case these fields are not yet filled */
    /* ============================================= */
    if t_sAPMatching.tcCInvoiceReference            = ?    or 
       t_sAPMatching.tcCInvoiceReference            = "":U or 
       t_sAPMatching.tcBusinessRelationCode         = ?    or
       t_sAPMatching.tcBusinessRelationCode         = "":U or 
       t_sAPMatching.tcCreditorCode                 = ?    or 
       t_sAPMatching.tcCreditorCode                 = "":U or 
       t_sAPMatching.tdCInvoiceExchangeRate         = ?    or
       t_sAPMatching.tdCInvoiceExchangeRate         = 0    or 
       t_sAPMatching.tdCinvoiceRateScale            = ?    or 
       t_sAPMatching.tdCinvoiceRateScale            = 0    or 
       t_sAPMatching.tdCInvoiceCCRate               = ?    or
       t_sAPMatching.tdCInvoiceCCRate               = 0    or 
       t_sAPMatching.tdCinvoiceCCScale              = ?    or 
       t_sAPMatching.tdCinvoiceCCScale              = 0    or  
       t_sAPMatching.tdCInvoiceLCCCRate             = ?    or
       t_sAPMatching.tdCInvoiceLCCCRate             = 0    or 
       t_sAPMatching.tdCinvoiceLCCCScale            = ?    or 
       t_sAPMatching.tdCinvoiceLCCCScale            = 0    or
       t_sAPMatching.tcCurrencyCode                 = ?    or
       t_sAPMatching.tcCurrencyCode                 = "":U or 
       t_sAPMatching.ttCInvoiceDate                 = ?    or 
       t_sAPMatching.ttCInvoiceTaxPointDate         = ?    or
       t_sAPMatching.tcCInvoiceType                 = ?    or
       t_sAPMatching.tcCInvoiceType                 = "":U or
       t_sAPMatching.tcCInvoicePaymentConditionCode = ?    or 
       t_sAPMatching.tlCInvoiceIsInitialStatus      = ?    or
       t_sAPMatching.tlCreditorAddrIsEUCountry      = ?    or
       t_sAPMatching.tlCreditorAddrIsTaxInCity      = ?    or
       t_sAPMatching.tcCreditorAddrCountryCode      = "":U or
       t_sAPMatching.tcCreditorAddrCountryCode      = ?    or
       t_sAPMatching.tlShipToAddrIsEUCountry        = ?    or
       t_sAPMatching.tlShipToAddrIsTaxInCity        = ?    or
       t_sAPMatching.tcShipToAddrCountryCode        = "":U or
       t_sAPMatching.tcShipToAddrCountryCode        = ?    or
       t_sAPMatching.tiCInvoiceRegistrationNr       = 0   or
       t_sAPMatching.tiCInvoiceRegistrationNr       = ?
    then do :
        assign oiReturnStatus     = -1
               vcMsgAPMatching    = trim(substitute(#T-10'The invoice-related fields on the header are mandatory. Invoice: Year &1, Daybook &2 and Voucher &3.':255(56058)T-10#,string(t_sAPMatching.tiCInvoicePostingYear),t_sAPMatching.tcCInvoiceJournalCode,string(t_sAPMatching.tiCInvoiceVoucher))) + chr(10) + 
                                    trim(substitute(#T-11'The invoice-related fields are automatically completed if they have unknown values.':241(65762)T-11#)) 
               vcMessageContext = "tAPMatching.tcCInvoiceReference=":U + (if t_sAPMatching.tcCInvoiceReference = ? then "?":U else string(t_sAPMatching.tcCInvoiceReference)) + chr(2) + 
                                  "tAPMatching.tcBusinessRelationCode=":U + (if t_sAPMatching.tcBusinessRelationCode = ? then "?":U else string(t_sAPMatching.tcBusinessRelationCode)) + chr(2) + 
                                  "tAPMatching.tcCreditorCode=":U + (if t_sAPMatching.tcCreditorCode = ? then "?":U else string(t_sAPMatching.tcCreditorCode)) + chr(2) + 
                                  "tAPMatching.tdCInvoiceExchangeRate=":U + (if t_sAPMatching.tdCInvoiceExchangeRate = ? then "?":U else string(t_sAPMatching.tdCInvoiceExchangeRate)) + chr(2) + 
                                  "tAPMatching.tdCinvoiceRateScale=":U + (if t_sAPMatching.tdCinvoiceRateScale = ? then "?":U else string(t_sAPMatching.tdCinvoiceRateScale)) + chr(2) + 
                                  "tAPMatching.tdCInvoiceCCRate=":U + (if t_sAPMatching.tdCInvoiceCCRate = ? then "?":U else string(t_sAPMatching.tdCInvoiceCCRate)) + chr(2) + 
                                  "tAPMatching.tdCinvoiceCCScale=":U + (if t_sAPMatching.tdCInvoiceCCScale = ? then "?":U else string(t_sAPMatching.tdCinvoiceCCScale)) + chr(2) + 
                                  "tAPMatching.tdCInvoiceLCCCRate=":U + (if t_sAPMatching.tdCInvoiceLCCCRate = ? then "?":U else string(t_sAPMatching.tdCInvoiceLCCCRate)) + chr(2) + 
                                  "tAPMatching.tdCinvoiceLCCCScale=":U + (if t_sAPMatching.tdCInvoiceLCCCScale = ? then "?":U else string(t_sAPMatching.tdCinvoiceLCCCScale)) + chr(2) + 
                                  "tAPMatching.tcCurrencyCode=":U + (if t_sAPMatching.tcCurrencyCode = ? then "?":U else string(t_sAPMatching.tcCurrencyCode)) + chr(2) + 
                                  "tAPMatching.ttCInvoiceDate=":U + (if t_sAPMatching.ttCInvoiceDate = ? then "?":U else string(t_sAPMatching.ttCInvoiceDate)) + chr(2) + 
                                  "tAPMatching.ttCInvoiceTaxPointDate=":U + (if t_sAPMatching.ttCInvoiceTaxPointDate = ? then "?":U else string(t_sAPMatching.ttCInvoiceTaxPointDate)) + chr(2) + 
                                  "tAPMatching.tcCInvoiceType=":U + (if t_sAPMatching.tcCInvoiceType = ? then "?":U else string(t_sAPMatching.tcCInvoiceType)) + chr(2) + 
                                  "tAPMatching.tcCInvoicePaymentConditionCode=":U + (if t_sAPMatching.tcCInvoicePaymentConditionCode = ? then "?":U else t_sAPMatching.tcCInvoicePaymentConditionCode) + chr(2) +
                                  "tAPMatching.tlCInvoiceIsInitialStatus=":U + (if t_sAPMatching.tlCInvoiceIsInitialStatus = ? then "?":U else string(t_sAPMatching.tlCInvoiceIsInitialStatus)) + chr(2) +
                                  "tAPMatching.tlCreditorAddrIsEUCountry=":U + (if t_sAPMatching.tlCreditorAddrIsEUCountry = ? then "?":U else string(t_sAPMatching.tlCreditorAddrIsEUCountry)) + chr(2) + 
                                  "tAPMatching.tlCreditorAddrIsTaxInCity=":U + (if t_sAPMatching.tlCreditorAddrIsTaxInCity = ? then "?":U else string(t_sAPMatching.tlCreditorAddrIsTaxInCity)) + chr(2) + 
                                  "tAPMatching.tcCreditorAddrCountryCode=":U + (if t_sAPMatching.tcCreditorAddrCountryCode = ? then "?":U else string(t_sAPMatching.tcCreditorAddrCountryCode)) + chr(2) + 
                                  "tAPMatching.tlShipToAddrIsEUCountry=":U + (if t_sAPMatching.tlShipToAddrIsEUCountry = ? then "?":U else string(t_sAPMatching.tlShipToAddrIsEUCountry)) + chr(2) + 
                                  "tAPMatching.tlShipToAddrIsTaxInCity=":U + (if t_sAPMatching.tlShipToAddrIsTaxInCity = ? then "?":U else string(t_sAPMatching.tlShipToAddrIsTaxInCity)) + chr(2) + 
                                  "tAPMatching.tcShipToAddrCountryCode=":U + (if t_sAPMatching.tcShipToAddrCountryCode = ? then "?":U else string(t_sAPMatching.tcShipToAddrCountryCode)) + chr(2) + 
                                  "tAPMatching.tiCInvoiceRegistrationNr=":U + (if t_sAPMatching.tiCInvoiceRegistrationNr = ? then "?":U else string(t_sAPMatching.tiCInvoiceRegistrationNr)).
        <M-9 run SetMessage
           (input  vcMsgAPMatching (icMessage), 
            input  '':U (icArguments), 
            input  'tAPMatching.tcCInvoiceReference':U (icFieldName), 
            input  t_sAPMatching.tcCInvoiceReference (icFieldValue), 
            input  'E':U (icType), 
            input  3 (iiSeverity), 
            input  t_sAPMatching.tc_Rowid (icRowid), 
            input  'QadFin-5635':U (icFcMsgNumber), 
            input  '':U (icFcExplanation), 
            input  '':U (icFcIdentification), 
            input  vcMessageContext (icFcContext), 
            output viFcReturnSuper (oiReturnStatus)) in BAPMatching>
        Return.
    end. /* if */
    
    /* ======================== */
    /* Set Return status = OK   */
    /* ======================== */
    if oiReturnStatus = -98 
    then assign oiReturnStatus = 0.