project QadFinancials > class BPosting > method StdMaintainTTSub1

Description

ApiStdMaintainTTSub1; Sub-method of ApiStdMaintainTT WITHOUT Validate, AddUpd and Datasave


Parameters


icActioninputcharacter
bcLstReturninput-outputcharacter
bcLstPrimKeyinput-outputcharacter
bcLstRowidinput-outputcharacter
blSaveAsDraftinput-outputlogical
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BPosting.StdMaintainTT


program code (program7/bposting.p)

/* ===================================================================== */
/* Prerequisits: a tPosting record and a tApiPosting record is available */
/* and the tApiPostingLine, tApiPostingSaf, tApiPostingVat and           */
/* tApiPostingXRef records can be accessed                               */
/* NOTE: Postings are always in new-mode from external creation.         */
/* ===================================================================== */

/* ============================ */
/* Go through all posting-lines */
/* ============================ */
for each tApiPostingLine where 
         tApiPostingLine.tc_ParentRowid = tApiPosting.tc_Rowid and
         tApiPostingLine.tcGLCode      <> "":U             
         by tApiPostingLine.tc_Rowid :

    if tApiPostingLine.PostingLineDebitLC  = ?
    then assign tApiPostingLine.PostingLineDebitLC  = 0.

    if tApiPostingLine.PostingLineCreditLC  = ?
    then assign tApiPostingLine.PostingLineCreditLC = 0.

    if tApiPostingLine.PostingLineDebitCC = ?
    then assign tApiPostingLine.PostingLineDebitCC = 0.

    if tApiPostingLine.PostingLineCreditCC = ?
    then assign tApiPostingLine.PostingLineCreditCC = 0.         
    
    <Q-71 run GetGLIDBasedOnGLCode (all) (Read) (Cache)
       (input tApiPosting.Company_ID, (CompanyID)
        input tApiPostingLine.tcGLCode, (GLCode)
        output dataset tqGLIDBasedOnGLCode) in BGL>
         
    for first tqGLIDBasedOnGLCode where
              tqGLIDBasedOnGLCode.tcGLCode = tApiPostingLine.tcGLCode
              no-lock:
        if tqGLIDBasedOnGLCode.tlGLIsIntercoAccount = no 
        then assign tApiPostingLine.tcIntercoBusinessRelationCode = "":U
                    tApiPostingLine.IntercoBusinessRelation_ID    = 0.
        else             
        if tqGLIDBasedOnGLCode.tlGLIsIntercoAccount and
           (tApiPostingLine.tcIntercoBusinessRelationCode  = "" or tApiPostingLine.tcIntercoBusinessRelationCode = ?) and
           (tApiPostingLine.IntercoBusinessRelation_ID     = 0  or tApiPostingLine.IntercoBusinessRelation_ID    = ?)
        then do:
            assign tApiPostingLine.IntercoBusinessRelation_ID    = tqGLIDBasedOnGLCode.tiBusinessRelation_ID 
                   tApiPostingLine.tcIntercoBusinessRelationCode = ?.              
        end. /* ELSE IF tqGLById.tlGLIsIntercoAccount... */
        
    end. /* FOR FIRST tqGLByID */
           
    /* ========================================== */
    /* Create a new PostingLine and copy all data */
    /* ========================================== */
    <M-42 run AddDetailLine (input  'PostingLine':U (icTable), 
                    input  tPosting.tc_Rowid (icParentRowid), 
                    output viFcReturnSuper (oiReturnStatus)) in BPosting>
    if viFcReturnSuper > 0 then assign oiReturnStatus = viFcReturnSuper.
    if viFcReturnSuper >= 0 
    then do:
        <M-72 run SetRowidConvert
           (input  tApiPostingLine.tc_Rowid (icOldRowid), 
            input  tPostingLine.tc_Rowid (icNewRowid), 
            output viFcReturnSuper (oiReturnStatus)) in BPosting>
    end.

    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        if oiReturnStatus < 0
        then do: 
            assign blSaveAsDraft  = (icAction <> {&DAEMONACTION-SAVE} and icAction <> {&DAEMONACTION-VALIDATE})
                   bcLstReturn    = bcLstReturn  + chr(4) + string(viFcReturnSuper)
                   bcLstPrimKey   = bcLstPrimKey + chr(4) + "*":U
                   bcLstRowid     = bcLstRowid   + chr(4) + "*":U.
            return.
        end. /* if oiReturnStatus < 0 */
    end. /* if viFcReturnSuper <> 0 */

    buffer-copy tApiPostingLine 
        except PostingLine_ID 
               Posting_ID 
               tc_rowid 
               tc_ParentRowid 
               tc_status 
            to tPostingLine.
    assign tPostingLine.tlLinkedCrCyDaemonReqExists  = false.
    
    /* =========================================== */
    /* Fill AllocationKey in case it is not filled */
    /* =========================================== */
    if tPostingLine.tcAllocationKey <> '':U and 
       tPostingLine.tcAllocationKey <> ? 
    then assign tPostingLine.tcAllocationPostingLine = trim(string(tPosting.PostingYear))   + '/':U +
                                                       trim(string(tPosting.PostingPeriod)) + '/':U + 
                                                       trim(tPosting.tcJournalCode)          + '/':U + 
                                                       trim(string(tPosting.PostingVoucher)).
        
    /* ============================================================================================================ */
    /* New extention only applicable for the interfaces:                                                            */
    /*  - Note: normal situation: TC * Rate * Scale = LC (there is no validation on this                            */
    /* When Currency<>Local and ExchangeRate and ScaleFactor and TC and LC are filled then we will here check if    */
    /* - LC (rounded by viCompanyLCDec)                                                                             */
    /* - TC * Rate * Scale (rounded by viCompanyLCDec)                                                              */
    /* Are the same with an excption on the last significant digit                                                  */
    /* ============================================================================================================ */
    if ((tPostingLine.PostingLineCreditLC <> 0 and
         tPostingLine.PostingLineCreditLC <> ?) or
        (tPostingLine.PostingLineDebitLC  <> 0 and
         tPostingLine.PostingLineDebitLC  <> ?))     and 
       ((tPostingLine.PostingLineCreditTC <> 0 and
         tPostingLine.PostingLineCreditTC <> ?) or
        (tPostingLine.PostingLineDebitTC  <> 0 and
         tPostingLine.PostingLineDebitTC  <> ?))     and 
       tPostingLine.PostingLineExchangeRate <> 0     and
       tPostingLine.PostingLineExchangeRate <> ?     and
       tPostingLine.PostingLineRateScale    <> 0     and
       tPostingLine.PostingLineRateScale    <> ?     and 
       tPostingLine.tcCurrencyCode          <> vcCompanyLC
    then do :
        /* Check if the passed LC is acceptable */
        assign vdPostingAmountInputLC = tPostingLine.PostingLineCreditLC - tPostingLine.PostingLineDebitLC
               vdPostingAmountCalcLC = <M-75 RoundAmount
                                          (input  (tPostingLine.PostingLineCreditTC - tPostingLine.PostingLineDebitTC) * tPostingLine.PostingLineExchangeRate * tPostingLine.PostingLineRateScale (idUnroundedAmount), 
                                           input  viCompanyLCId (iiCurrencyID), 
                                           input  vcCompanyLC (icCurrencyCode)) in BApplicationProperty>. 
               
        if viCompanyLCDec = 0 or viCompanyLCDec = ?
        then assign vdTolerance = 1.
        else assign vdTolerance = 1 / (10 * viCompanyLCDec).
                
        if ABS (vdPostingAmountInputLC - vdPostingAmountCalcLC) > vdTolerance
        then do :
            assign vcMsgExplanation = <M-84 GetErrorExplanation
                                         (input  tPosting.tc_Rowid (icPostingRowId), 
                                          input  tPostingLine.tc_Rowid (icPostingLineRowId), 
                                          output viFcReturnSuper (oiReturnStatus)) in BPosting>.
                                                  
            assign vcMessage      = trim(substitute(#T-53'The rounded values for the BC Amount and the TC Amount (multiplied by the Exchange Rate and the Rate Scale) should be the same (except the last significant character)':255(73470646)T-53#)) + chr(10) +
                                    trim(substitute(#T-55'When you pass amounts and exchange rates for posting lines in foreign currency, the allowed differences between the TC amount (plus rates) and BC amount is limited':255(413962953)T-55#)) + chr(10) +
                                    trim(substitute(#T-54'TC Credit Amount in posting line: &1.':255(31341)T-54#, trim(string(tPostingLine.PostingLineCreditTC)))) + chr(10) + 
                                    trim(substitute(#T-56'TC Debit Amount in posting line: &1.':255(31343)T-56#, trim(string(tPostingLine.PostingLineDebitTC)))) + chr(10) + 
                                    trim(substitute(#T-57'BC Credit Amount in posting line: &1.':255(31344)T-57#, trim(string(tPostingLine.PostingLineCreditLC)))) + chr(10) + 
                                    trim(substitute(#T-58'BC Debit Amount in posting line: &1.':255(31345)T-58#, trim(string(tPostingLine.PostingLineDebitLC)))) + chr(10) + 
                                    trim(substitute(#T-76'BC Amount in posting line: &1':255(733740406)T-76#,trim(string(abs (tPostingLine.PostingLineCreditLC - tPostingLine.PostingLineDebitLC))))) + chr(10) +                                                                         
                                    trim(substitute(#T-77'Tolerance Value: &1':255(73460411)T-77#,string (vdTolerance))) +                                                                     
                                    trim(substitute(#T-61'Exchange Rate in posting line: &1.':255(31352)T-61#, trim(string(tPostingLine.PostingLineExchangeRate)))) + chr(10) + 
                                    trim(substitute(#T-62'Rate Scale in posting line : &1.':255(591285913)T-62#, trim(string(tPostingLine.PostingLineRateScale)))) + chr(10) + 
                                    trim(substitute(#T-52'Number of decimals for BC amounts: &1.':255(31354)T-52#, trim(string(viCompanyLCDec)))) + chr (10) +
                                    trim(substitute(#T-9'Daybook code: &1':222(31365)T-9#, tPosting.tcJournalCode)) + ' ' +
                                    trim(substitute(#T-59'Daybook type: &1':255(64046)T-59#, tPosting.tcJournalTypeCode)).
            
            /* Get some properties of the daybook and cache them in local data items for performance reasons */
            if tPosting.tcJournalCode <> ? and 
               tPosting.tcJournalCode <> ''
            then do:
                /* Get some properties of the daybook */
                <Q-30 run JournalByJournalCode (all) (Read) (Cache)
                   (input tPosting.Company_ID, (CompanyId)
                    input tPosting.tcJournalCode, (JournalCode)
                    output dataset tqJournalByJournalCode) in BJournal>
                      
                find first tqJournalByJournalCode where
                           tqJournalByJournalCode.tcJournalCode =  tPosting.tcJournalCode
                           no-error.       

            end. /* if tPosting.tcJournalCode <> ? */
        
            /* ============================================================================================================================= */
            /* In case the transaction has an Operational Sales Invoice Daybook, the validation is considered as a warning and not an error */
            /* ============================================================================================================================= */
            if tPosting.tcJournalCode <> ?                                                      and 
               tPosting.tcJournalCode <> ''                                                     and
               available tqJournalByJournalCode                                                 and
               tqJournalByJournalCode.tcJournalCode      =  tPosting.tcJournalCode              and
               tqJournalByJournalCode.tcJournalControl   = {&JOURNALCONTROL-LOGISTIC}           and
               (tqJournalByJournalCode.tcJournalTypeCode = {&JOURNALTYPE-DEBTORINVOICE}         or
                tqJournalByJournalCode.tcJournalTypeCode = {&JOURNALTYPE-DEBTORINVOICECORRECT}  or
                tqJournalByJournalCode.tcJournalTypeCode = {&JOURNALTYPE-DEBTORCREDITNOTE}      or
                tqJournalByJournalCode.tcJournalTypeCode = {&JOURNALTYPE-DEBTORCREDITNOTECORRECT})
            then do:
                <M-92 run SetMessage
                   (input  vcMessage (icMessage), 
                    input  '':U (icArguments), 
                    input  '':U (icFieldName), 
                    input  '':U (icFieldValue), 
                    input  'W':U (icType), 
                    input  3 (iiSeverity), 
                    input  '':U (icRowid), 
                    input  'qadfin-488926':U (icFcMsgNumber), 
                    input  vcMsgExplanation (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BPosting>   
                if oiReturnStatus = 0
                then assign oiReturnStatus = +1.
            end. /* vlIsCustomerInvoice: Warning */
            else do:
                assign blSaveAsDraft  = (icAction <> {&DAEMONACTION-SAVE} and icAction <> {&DAEMONACTION-VALIDATE})
                       bcLstReturn    = bcLstReturn  + chr(4) + string(-1)
                       bcLstPrimKey   = bcLstPrimKey + chr(4) + "*":U
                       bcLstRowid     = bcLstRowid   + chr(4) + "*":U.
                <M-43 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-7180':U (icFcMsgNumber), 
                    input  vcMsgExplanation (icFcExplanation), 
                    input  '' (icFcIdentification), 
                    input  '' (icFcContext), 
                    output viFcReturnSuper (oiReturnStatus)) in BPosting>
                assign oiReturnStatus = -1.
                Return.
            end. /* not vlIsCustomerInvoice : Error */
        end. /* if vdPostingLineAmountTC <> vdPostingLineAmountLC */
    end. /* if */
                                                       
    /* ===================================================================================== */
    /* If the SAF Structure is not specified then use tApiPostingSaf as a source of SAF code */
    /* Call StdMaintainTTSub11 to determine SAF Structures and processing SAF             */
    /* ===================================================================================== */
    if can-find (first tApiPostingSaf where 
                       tApiPostingSaf.tc_ParentRowid      = tApiPostingLine.tc_Rowid and 
                       tApiPostingSaf.tc_status          <> "D":U                    and 
                       tApiPostingSaf.tcSafConceptCode   <> "":U                     and 
                       tApiPostingSaf.tcSafConceptCode   <> ?                        and 
                       (tApiPostingSaf.tcSafStructureCode = "":U or 
                        tApiPostingSaf.tcSafStructureCode = ?)) or
        not can-find(first tApiPostingSaf where 
                           tApiPostingSaf.tc_ParentRowid      = tApiPostingLine.tc_Rowid and 
                           tApiPostingSaf.tc_status          <> "D":U)
    then do:
        /* Update the postingline_id so that the record can be found in StdMaintainTTSub11 */
        for each tApiPostingSaf where 
                 tApiPostingSaf.tc_ParentRowid = tApiPostingLine.tc_Rowid
                 by tApiPostingSaf.tc_Rowid :
            assign tApiPostingSaf.PostingLine_ID = tPostingLine.PostingLine_ID.
        end.

        <M-68 run StdMaintainTTSub11  (output viFcReturnSuper (oiReturnStatus)) in BPosting>

        if viFcReturnSuper <> 0
        then do:
            assign oiReturnStatus = viFcReturnSuper.
            if oiReturnStatus < 0
            then do: 
                assign blSaveAsDraft  = (icAction <> {&DAEMONACTION-SAVE} and icAction <> {&DAEMONACTION-VALIDATE})
                       bcLstReturn    = bcLstReturn  + chr(4) + string(viFcReturnSuper)
                       bcLstPrimKey   = bcLstPrimKey + chr(4) + "*":U
                       bcLstRowid     = bcLstRowid   + chr(4) + "*":U.
                return.
            end. /* if oiReturnStatus < 0 */
        end. /* if viFcReturnSuper <> 0 */

    end. /* if can-find (first tApiPostingSaf where  */
    else do:
        /* ============================================= */
        /* Go through all PostingSAFs                    */
        /* ============================================= */
        for each tApiPostingSaf where 
                 tApiPostingSaf.tc_ParentRowid = tApiPostingLine.tc_Rowid
                 by tApiPostingSaf.tc_Rowid :

            /* ============================================= */
            /* Create PostingSAF and copy the data           */
            /* ============================================= */
            <M-41 run AddDetailLine (input  'PostingSAF':U (icTable), 
                        input  tPostingLine.tc_Rowid (icParentRowid), 
                        output viFcReturnSuper (oiReturnStatus)) in BPosting>

            if viFcReturnSuper > 0 then assign oiReturnStatus = viFcReturnSuper.
            if viFcReturnSuper >= 0 
            then do:
                <M-73 run SetRowidConvert
                   (input  tApiPostingSaf.tc_Rowid (icOldRowid), 
                    input  tPostingSaf.tc_Rowid (icNewRowid), 
                    output viFcReturnSuper (oiReturnStatus)) in BPosting>
            end.                            

            if viFcReturnSuper <> 0
            then do:
                assign oiReturnStatus = viFcReturnSuper.
                if oiReturnStatus < 0
                then do: 
                    assign blSaveAsDraft  = (icAction <> {&DAEMONACTION-SAVE} and icAction <> {&DAEMONACTION-VALIDATE})
                           bcLstReturn    = bcLstReturn  + chr(4) + string(viFcReturnSuper)
                           bcLstPrimKey   = bcLstPrimKey + chr(4) + "*":U
                           bcLstRowid     = bcLstRowid   + chr(4) + "*":U.
                    return.
                end. /* if oiReturnStatus < 0 */
            end. /* if viFcReturnSuper <> 0 */

            buffer-copy tApiPostingSaf
                except PostingSaf_ID 
                       PostingLine_ID 
                       tc_rowid 
                       tc_ParentRowid 
                       tc_status 
                to tPostingSaf.

        end. /* for each tApiPostingSaf where */
    end.  /* else do */

    if tPosting.PostingOriginIsExternal = true 
    then 
        for each tPostingSaf where 
                 tPostingSaf.tc_ParentRowid =  tPostingLine.tc_Rowid and 
                 tPostingSaf.tc_status <> "D":U and 
                 tPostingSaf.tcSafCode <> "":U and 
                 tPostingSaf.tcSafCode <> ? and 
                 tPostingSaf.tcSafConceptCode <> "":U and 
                 tPostingSaf.tcSafConceptCode <> ? and
                 tPostingSaf.tcSafStructureCode <> "":U and
                 tPostingSaf.tcSafStructureCode <> ?:

            <Q-48 assign vlFcQueryRecordsAvailable = SafPrim (NoCache)  (input ?, (SafID) 
                                                  input tPostingSaf.tcSafCode, (SafCode) 
                                                  input tPostingSaf.tcSafConceptCode, (SafConceptCode)) in BSaf >

            if vlFcQueryRecordsAvailable = false and
               not can-find(first tApiSafFromPosting where
                                  tApiSafFromPosting.tcSafConceptCode  = tPostingSaf.tcSafConceptCode and
                                  tApiSafFromPosting.SafCode           = tPostingSaf.tcSafCode)
            then do:
                create tApiSafFromPosting.
                assign tApiSafFromPosting.SafCode          = tPostingSaf.tcSafCode
                       tApiSafFromPosting.SafDescription   = tApiSafFromPosting.SafCode
                       tApiSafFromPosting.tcSafConceptCode = tPostingSaf.tcSafConceptCode
                       tApiSafFromPosting.SafIsActive      = true
                       tApiSafFromPosting.tc_Rowid         = string(rowid(tApiSafFromPosting)).
            end. /* if vlFcQueryRecordsAvailable = false and */

        end. /* for each tPostingSaf */
    
    /* ============================================= */
    /* Go through all PostingVATs                    */
    /* ============================================= */
    for each tApiPostingVat where 
             tApiPostingVat.tc_ParentRowid = tApiPostingLine.tc_Rowid
             by tApiPostingVat.tc_Rowid :
        
        /* ============================================= */
        /* Create PostingVAT and copy the data           */
        /* ============================================= */
        <M-49 run AddDetailLine (input  'PostingVat':U (icTable), 
                    input  tPostingLine.tc_Rowid (icParentRowid), 
                    output viFcReturnSuper (oiReturnStatus)) in BPosting>

        if viFcReturnSuper > 0 then assign oiReturnStatus = viFcReturnSuper.
        if viFcReturnSuper >= 0 
        then do:                        
            <M-74 run SetRowidConvert
               (input  tApiPostingVat.tc_Rowid (icOldRowid), 
                input  tPostingVat.tc_Rowid (icNewRowid), 
                output viFcReturnSuper (oiReturnStatus)) in BPosting>
        end.

        if viFcReturnSuper <> 0
        then do:
            assign oiReturnStatus = viFcReturnSuper.
            if oiReturnStatus < 0
            then do: 
                assign blSaveAsDraft  = (icAction <> {&DAEMONACTION-SAVE} and icAction <> {&DAEMONACTION-VALIDATE})
                       bcLstReturn    = bcLstReturn  + chr(4) + string(viFcReturnSuper)
                       bcLstPrimKey   = bcLstPrimKey + chr(4) + "*":U
                       bcLstRowid     = bcLstRowid   + chr(4) + "*":U.
                return.
            end. /* if oiReturnStatus < 0 */
        end. /* if viFcReturnSuper <> 0 */

        buffer-copy tApiPostingVat 
            except PostingVat_ID 
                   PostingLine_ID 
                   tc_rowid 
                   tc_ParentRowid 
                   tc_status 
            to tPostingVat.
        
        /* ========================================================== */
        /* Fill in bVatRule_id                                         */
        /* Get all VatRules for this Vat_id and use the same sequence */
        /* ========================================================== */
        if tPostingVat.tcVatCode = "":U or 
           tPostingVat.tcVatCode = ?
        then next.

        <Q-50 run VatRuleByVatIDCode (all) (Read) (Cache)
           (input tPostingVat.tcVatCode, (VatCode)
            input ?, (VatID)
            input {&VATRULEBASE-FULL}, (VatRuleBaseFull)
            input tPostingVat.tcVatInOut, (VatInOut)
            input tPostingVat.tcDomainCode, (DomainCode)
            output dataset tqVatRuleByVatIDCode) in BVAT >

        if tPostingVat.PostingVatIsAbsRet = true
        then find last tqVatRuleByVatIDCode where
                       tqVatRuleByVatIDCode.tcVatCode         = tPostingVat.tcVatCode and
                       tqVatRuleByVatIDCode.tcVatInOut        = tPostingVat.tcVatInOut and
                       tqVatRuleByVatIDCode.tcDomainCode      = tPostingVat.tcDomainCode and
                       tqVatRuleByVatIDCode.tcVatRuleBaseFull = {&VATRULEBASE-FULL}
                       no-error. /* First one gives the normal tax - the second one gives the one for retained and absorbed taxes: this needs to be made conditional (first-lat) based upon a new field in PostingVat */
        else find first tqVatRuleByVatIDCode where
                        tqVatRuleByVatIDCode.tcVatCode         = tPostingVat.tcVatCode and
                        tqVatRuleByVatIDCode.tcVatInOut        = tPostingVat.tcVatInOut and
                        tqVatRuleByVatIDCode.tcDomainCode      = tPostingVat.tcDomainCode and
                        tqVatRuleByVatIDCode.tcVatRuleBaseFull = {&VATRULEBASE-FULL}
                        no-error. /* First one gives the normal tax - the second one gives the one for retained and absorbed taxes: this needs to be made conditional (first-lat) based upon a new field in PostingVat */
        if not available tqVatRuleByVatIDCode
        then do:
            assign vcMsgExplanation = <M-21 GetErrorExplanation
                                         (input  tPosting.tc_Rowid (icPostingRowId), 
                                          input  tPostingLine.tc_Rowid (icPostingLineRowId), 
                                          output viFcReturnSuper (oiReturnStatus)) in BPosting>.
                          
            assign vcMessage      = trim(substitute(#T-70'Internal error: the tax-posting-line cannot be created as the Vat-rule cannot be found based upon the Domain (&1), Tax-code (&2) and Tax-direction (&3).':255(332065953)T-70#,tPostingVat.tcDomainCode,tPostingVat.tcVatCode,tPostingVat.tcVatInOut))
                   oiReturnStatus = -3.
            <M-69 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-8023':U (icFcMsgNumber), 
                input  vcMsgExplanation (icFcExplanation), 
                input  '':U (icFcIdentification), 
                input  '':U (icFcContext), 
                output viFcReturnSuper (oiReturnStatus)) in BPosting>
            Return.
        end. /* if not available tqVatRuleByVatIDCode */

        assign tPostingVat.VatRule_ID = tqVatRuleByVatIDCode.tiVatRule_ID.
        
    end. /* for each tApiPostingVat where */
    
end. /* for each tApiPostingLine where */