project QadFinancials > class BYearClosing > method AdditionalUpdatesPostingCloseOpenBS

Description

Submethod of AdditionalUpdatesPostingCloseOpen to close the Balance Sheet Accounts


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BYearClosing.AdditionalUpdatesPostingCloseOpen


program code (program5/byearclosing.p)

assign oiReturnStatus = -98.
    
    /* Closing Postings for Balance Sheet accounts */
    assign vlHeaderCreated = false
           viCnt           = 0.
    for each tPostingHistClosing where
             tPostingHistClosing.tlClosingGLIsBalanceAcc = true
             by tPostingHistClosing.tcClosingGLCode
             by tPostingHistClosing.tcClosingDivisionCode:
    
        /* make sure either debit or credit is 0 */
        assign vdDebitLC  = tPostingHistClosing.tdClosingDebitLC
               vdCreditLC = tPostingHistClosing.tdClosingCreditLC
               vdDebitCC  = tPostingHistClosing.tdClosingDebitCC
               vdCreditCC = tPostingHistClosing.tdClosingCreditCC
               tPostingHistClosing.tdClosingDebitLC  = tPostingHistClosing.tdClosingDebitLC  - min(vdDebitLC, vdCreditLC)
               tPostingHistClosing.tdClosingCreditLC = tPostingHistClosing.tdClosingCreditLC - min(vdDebitLC, vdCreditLC)
               tPostingHistClosing.tdClosingDebitCC  = tPostingHistClosing.tdClosingDebitCC  - min(vdDebitCC, vdCreditCC)
               tPostingHistClosing.tdClosingCreditCC = tPostingHistClosing.tdClosingcreditCC - min(vdDebitCC, vdCreditCC).
        if tPostingHistClosing.tdClosingDebitLC  = 0 and
           tPostingHistClosing.tdClosingCreditLC = 0 and
           tPostingHistClosing.tdClosingDebitCC  = 0 and
           tPostingHistClosing.tdClosingCreditCC = 0
        then next.                   
             
        if vlHeaderCreated = false
        then do:
            /* Postingheader for closing */
             assign vcPostingText = trim(#T-21'Year-End Closing: Bal. Sheet Closing.':200(999890464)T-21#)
                    vcPostingText = substring(vcPostingText,1,40,"Character").
            <M-1 run AddPostingHeader
               (input  tYearClosing.Company_ID (iiCompanyId), 
                input  tYearClosing.YearClosingAccountingYear (iiPeriodYear), 
                input  tqPeriodByYearPeriod.tiPeriodPeriod + 1 (iiPeriodPeriod), 
                input  tYearClosing.tcClosingBalanceJournalCode (icJournalCode), 
                input  '' (icReportingJournalCode), 
                input  0 (iiVoucher), 
                input  tqPeriodByYearPeriod.ttPeriodEndDate (itPostingDate), 
                input  ? (itValueDate), 
                input  vcPostingText (icPostingText), 
                input  '':U (icPostingBusinessRelationText), 
                input  '':U (icPostingInvoiceReferenceText), 
                input  '':U (icPostingParentText), 
                input  viBPeriodYearClosingID (iiBPeriodId), 
                input  ? (icPostingOriginAddressCode), 
                input  ? (icPostingOriginDocument), 
                input  ? (icPostingOriginDocumentType), 
                input  '':U (icBatchNumber), 
                input  ? (icBankImpLineRef), 
                output viPostingID (oiPostingId), 
                output vcPostingRowid (ocRowid), 
                output viPostingVoucher (oiPostingVoucher), 
                output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>   
            assign vlHeaderCreated = true.
            if viFcReturnSuper <> 0 and oiReturnStatus >= 0
            then assign oiReturnStatus = viFcReturnSuper.                           
            if viFcReturnSuper < 0 
            then return.            
            
            /* Update Additional GL Numbering date */
            if vlIsAddGLNbr
            then do:
                <M-95 run SetNumberingDate
                   (input  viPostingID (iiPostingID), 
                    input  tYearClosing.YearClosingCloAddGLNbrDate (itNbrDate), 
                    output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
                if viFcReturnSuper <> 0 and oiReturnStatus >= 0
                then assign oiReturnStatus = viFcReturnSuper.                           
                if viFcReturnSuper < 0 
                then return.
            end. /* if vlIsAddGLNbr */
            
            assign vcPostingText = trim(#T-22'Year-End Closing: Bal. Sheet Reopening.':200(999890465)T-22#)
                   vcPostingText = substring(vcPostingText,1,40,"Character"). 
            /* Postingheader for Opening */
            <M-2 run AddPostingHeader
               (input  tYearClosing.Company_ID (iiCompanyId), 
                input  tYearClosing.YearClosingAccountingYear + 1 (iiPeriodYear), 
                input  0 (iiPeriodPeriod), 
                input  tYearClosing.tcClosingBalanceJournalCode (icJournalCode), 
                input  '' (icReportingJournalCode), 
                input  0 (iiVoucher), 
                input  tqPeriodByYearPeriod.ttPeriodEndDate + 1 (itPostingDate), 
                input  ? (itValueDate), 
                input  vcPostingText (icPostingText), 
                input  '':U (icPostingBusinessRelationText), 
                input  '':U (icPostingInvoiceReferenceText), 
                input  '':U (icPostingParentText), 
                input  viBPeriodYearClosingID (iiBPeriodId), 
                input  ? (icPostingOriginAddressCode), 
                input  ? (icPostingOriginDocument), 
                input  ? (icPostingOriginDocumentType), 
                input  '':U (icBatchNumber), 
                input  ? (icBankImpLineRef), 
                output viPostingID (oiPostingId), 
                output vcPostingOpenRowid (ocRowid), 
                output viPostingVoucher (oiPostingVoucher), 
                output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
            if viFcReturnSuper <> 0 and oiReturnStatus >= 0
            then assign oiReturnStatus = viFcReturnSuper.                           
            if viFcReturnSuper < 0 
            then return.
            
            /* Update Additional GL Numbering date */
            if vlIsAddGLNbr
            then do:
                <M-16 run SetNumberingDate
                   (input  viPostingID (iiPostingID), 
                    input  tYearClosing.YearClosingReoAddGLNbrDate (itNbrDate), 
                    output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
                if viFcReturnSuper <> 0 and oiReturnStatus >= 0
                then assign oiReturnStatus = viFcReturnSuper.                           
                if viFcReturnSuper < 0 
                then return.
            end. /* if vlIsAddGLNbr */
            
            assign vlHeaderCreated = true.                
        end. /* if vlHeaderCreated = false */
        
        /* Fill allocation key for Open Item postings */
        if tPostingHistClosing.tcClosingGLTypeCode = {&GLTYPECODE-OPEN}
        then assign viCnt           = viCnt + 1
                    vcAllocationKey = trim("PostingId-":U) + trim(string(viPostingID)) + trim("-Nbr-":U) + trim(string(viCnt)).
        else assign vcAllocationKey = '':U.
        assign vcPostingText = trim(#T-23'Year-End Closing: Bal. Sheet Closing.':200(999890467)T-23#)
               vcPostingText = substring(vcPostingText,1,40,"Character").
        
        /* check if include sub-account is yes at year end-closing */
         if tYearClosing.YearClosingIsInclDivision = true
            then assign vcDivisionCode = tPostingHistClosing.tcClosingDivisionCode.
            else assign vcDivisionCode = '':U. 
                   
        /* PostingLine for closing */  
             
         
            <M-29 run AddStandardPosting
               (input  vcPostingRowid (icPostingtcRowid), 
                input  tPostingHistClosing.tcClosingGLCode (icGLCode), 
                input  vcDivisionCode (icDivisionCode), 
                input  '':U (icCostCentreCode), 
                input  '':U (icCostCentreText), 
                input  '':U (icProjectCode), 
                input  '':U (icProjectText), 
                input  '':U (icIntercoBusinessRelationCode), 
                input  vcCompanyLC (icCurrencyCode), 
                input  tPostingHistClosing.tdClosingCreditLC (idDebitTC), 
                input  tPostingHistClosing.tdClosingCreditLC (idDebitLC), 
                input  tPostingHistClosing.tdClosingCreditCC (idDebitCC), 
                input  0 (idDebitPC), 
                input  tPostingHistClosing.tdClosingDebitLC (idCreditTC), 
                input  tPostingHistClosing.tdClosingDebitLC (idCreditLC), 
                input  tPostingHistClosing.tdClosingDebitCC (idCreditCC), 
                input  0 (idCreditPC), 
                input  0 (idQty), 
                input  vcPostingText (icLineText), 
                input  '':U (icSafText), 
                input  tDefaultSaf (tDefaultSafs), 
                input  {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateType), 
                input  1 (idExchangeRate), 
                input  1 (idExchangeRateScale), 
                input  ? (idPostingLineCCRate), 
                input  ? (idPostingLineCCScale), 
                output viPostingLineID (oiPostingLineId), 
                input  0 (iiSafStructureId), 
                input  '':U (icSafStructureCode), 
                input  vcAllocationKey (icAllocationKey), 
                input  false (ilLinkedCrCyDaemonReqExists), 
                input  ? (itExchangeRateDate), 
                output viFcReturnSuper (oiReturnStatus)) in BJournalEntry> 
        if viFcReturnSuper <> 0 and oiReturnStatus >= 0
        then assign oiReturnStatus = viFcReturnSuper.                           
        if viFcReturnSuper < 0 
        then return.             
        
        /* Create Tax Accounts if necessary */        
        if tPostingHistClosing.tcClosingGLTypeCode = {&GLTYPECODE-VAT}
        then do:
            assign vdCCExchangeRate = if tPostingHistClosing.tdClosingCreditLC <> 0 and
                                         tPostingHistClosing.tdClosingCreditLC <> ?
                                      then tPostingHistClosing.tdClosingCreditCC / tPostingHistClosing.tdClosingCreditLC
                                      else tPostingHistClosing.tdClosingDebitCC / tPostingHistClosing.tdClosingDebitLC.

            <M-10 run AdditionalUpdatesPostingTaxAccount
               (input  tYearClosing.Company_ID (iiCompanyId), 
                input  tYearClosing.YearClosingDefTaxCode (icDefaultTaxCode), 
                input  vcPostingRowid (icPostingtcRowid), 
                input  viPostingLineID (iiPostingLineId), 
                input  vcCompanyLC (icCurrencyCode), 
                input  tqPeriodByYearPeriod.ttPeriodEndDate (itTaxPointDate), 
                input  tPostingHistClosing.tcClosingGLCode (icTaxGLCode), 
                input  1 (idExchangeRate), 
                input  vdCCExchangeRate (idCCExchangeRate), 
                input  1 (idCCExchangeRateScale), 
                output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
            if viFcReturnSuper <> 0 and oiReturnStatus >= 0
            then assign oiReturnStatus = viFcReturnSuper.                           
            if viFcReturnSuper < 0 
            then return.    
        end.        

        /* Fill allocation key for Open Item postings */
        if tPostingHistClosing.tcClosingGLTypeCode = {&GLTYPECODE-OPEN}
        then assign vcAllocationKey = vcAllocationKey + chr(2) + "L":U.
        else assign vcAllocationKey = '':U.
        assign vcPostingText = trim(#T-24'Year-End Closing: Bal. Sheet Reopening.':200(999890465)T-24#)
               vcPostingText = substring(vcPostingText,1,40,"Character").
        /* PostingLine for reopening */       
        <M-9 run AddStandardPosting
           (input  vcPostingOpenRowid (icPostingtcRowid), 
            input  tPostingHistClosing.tcClosingGLCode (icGLCode), 
            input  vcDivisionCode (icDivisionCode), 
            input  '':U (icCostCentreCode), 
            input  '':U (icCostCentreText), 
            input  '':U (icProjectCode), 
            input  '':U (icProjectText), 
            input  '':U (icIntercoBusinessRelationCode), 
            input  vcCompanyLC (icCurrencyCode), 
            input  tPostingHistClosing.tdClosingDebitLC (idDebitTC), 
            input  tPostingHistClosing.tdClosingDebitLC (idDebitLC), 
            input  tPostingHistClosing.tdClosingDebitCC (idDebitCC), 
            input  0 (idDebitPC), 
            input  tPostingHistClosing.tdClosingCreditLC (idCreditTC), 
            input  tPostingHistClosing.tdClosingCreditLC (idCreditLC), 
            input  tPostingHistClosing.tdClosingCreditCC (idCreditCC), 
            input  0 (idCreditPC), 
            input  0 (idQty), 
            input  vcPostingText (icLineText), 
            input  '':U (icSafText), 
            input  tDefaultSaf (tDefaultSafs), 
            input  {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateType), 
            input  1 (idExchangeRate), 
            input  1 (idExchangeRateScale), 
            input  ? (idPostingLineCCRate), 
            input  ? (idPostingLineCCScale), 
            output viPostingLineID (oiPostingLineId), 
            input  0 (iiSafStructureId), 
            input  '':U (icSafStructureCode), 
            input  vcAllocationKey (icAllocationKey), 
            input  false (ilLinkedCrCyDaemonReqExists), 
            input  ? (itExchangeRateDate), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
        if viFcReturnSuper <> 0 and oiReturnStatus >= 0
        then assign oiReturnStatus = viFcReturnSuper.                           
        if viFcReturnSuper < 0 
        then return.     

        /* Create Tax Accounts if necessary */        
        if tPostingHistClosing.tcClosingGLTypeCode = {&GLTYPECODE-VAT}
        then do:
            assign vdCCExchangeRate = if tPostingHistClosing.tdClosingCreditLC <> 0 and
                                         tPostingHistClosing.tdClosingCreditLC <> ?
                                      then tPostingHistClosing.tdClosingCreditCC / tPostingHistClosing.tdClosingCreditLC
                                      else tPostingHistClosing.tdClosingDebitCC / tPostingHistClosing.tdClosingDebitLC.

            <M-11 run AdditionalUpdatesPostingTaxAccount
               (input  tYearClosing.Company_ID (iiCompanyId), 
                input  tYearClosing.YearClosingDefTaxCode (icDefaultTaxCode), 
                input  vcPostingOpenRowid (icPostingtcRowid), 
                input  viPostingLineID (iiPostingLineId), 
                input  vcCompanyLC (icCurrencyCode), 
                input  tqPeriodByYearPeriod.ttPeriodEndDate + 1 (itTaxPointDate), 
                input  tPostingHistClosing.tcClosingGLCode (icTaxGLCode), 
                input  1 (idExchangeRate), 
                input  vdCCExchangeRate (idCCExchangeRate), 
                input  1 (idCCExchangeRateScale), 
                output viFcReturnSuper (oiReturnStatus)) in BYearClosing>
            if viFcReturnSuper <> 0 and oiReturnStatus >= 0
            then assign oiReturnStatus = viFcReturnSuper.                           
            if viFcReturnSuper < 0 
            then return.    
        end.  
    end. /* for each tPostingHistClosing where GLIsBalanceAcc = false */       

    /* If there are no postings on balance accounts, but there was a transfer on PL accounts, we need to create the headers */
    if vlHeaderCreated = false and
       can-find(first tPLAmounts)
    then do:
        /* Postingheader for closing */  
         assign vcPostingText = trim(#T-25'Year-End Closing: Bal. Sheet Closing.':200(999890464)T-25#)
                vcPostingText = substring(vcPostingText,1,40,"Character").
        <M-17 run AddPostingHeader
           (input  tYearClosing.Company_ID (iiCompanyId), 
            input  tYearClosing.YearClosingAccountingYear (iiPeriodYear), 
            input  tqPeriodByYearPeriod.tiPeriodPeriod + 1 (iiPeriodPeriod), 
            input  tYearClosing.tcClosingBalanceJournalCode (icJournalCode), 
            input  '' (icReportingJournalCode), 
            input  0 (iiVoucher), 
            input  tqPeriodByYearPeriod.ttPeriodEndDate (itPostingDate), 
            input  ? (itValueDate), 
            input  vcPostingText (icPostingText), 
            input  '':U (icPostingBusinessRelationText), 
            input  '':U (icPostingInvoiceReferenceText), 
            input  '':U (icPostingParentText), 
            input  viBPeriodYearClosingID (iiBPeriodId), 
            input  ? (icPostingOriginAddressCode), 
            input  ? (icPostingOriginDocument), 
            input  ? (icPostingOriginDocumentType), 
            input  '':U (icBatchNumber), 
            input  ? (icBankImpLineRef), 
            output viPostingID (oiPostingId), 
            output vcPostingRowid (ocRowid), 
            output viPostingVoucher (oiPostingVoucher), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>   
        assign vlHeaderCreated = true.
        if viFcReturnSuper <> 0 and oiReturnStatus >= 0
        then assign oiReturnStatus = viFcReturnSuper.                           
        if viFcReturnSuper < 0 
        then return.
        
        /* Update Additional GL Numbering date */
        if vlIsAddGLNbr
        then do:
            <M-89 run SetNumberingDate
               (input  viPostingID (iiPostingID), 
                input  tYearClosing.YearClosingCloAddGLNbrDate (itNbrDate), 
                output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
            if viFcReturnSuper <> 0 and oiReturnStatus >= 0
            then assign oiReturnStatus = viFcReturnSuper.                           
            if viFcReturnSuper < 0 
            then return.
        end. /* if vlIsAddGLNbr */
        
        assign vcPostingText = trim(#T-26'Year-End Closing: Bal. Sheet Reopening.':200(999890465)T-26#)
               vcPostingText = substring(vcPostingText,1,40,"Character").
        /* Postingheader for Opening */
        <M-18 run AddPostingHeader
           (input  tYearClosing.Company_ID (iiCompanyId), 
            input  tYearClosing.YearClosingAccountingYear + 1 (iiPeriodYear), 
            input  0 (iiPeriodPeriod), 
            input  tYearClosing.tcClosingBalanceJournalCode (icJournalCode), 
            input  '' (icReportingJournalCode), 
            input  0 (iiVoucher), 
            input  tqPeriodByYearPeriod.ttPeriodEndDate + 1 (itPostingDate), 
            input  ? (itValueDate), 
            input  vcPostingText (icPostingText), 
            input  '':U (icPostingBusinessRelationText), 
            input  '':U (icPostingInvoiceReferenceText), 
            input  '':U (icPostingParentText), 
            input  viBPeriodYearClosingID (iiBPeriodId), 
            input  ? (icPostingOriginAddressCode), 
            input  ? (icPostingOriginDocument), 
            input  ? (icPostingOriginDocumentType), 
            input  '':U (icBatchNumber), 
            input  ? (icBankImpLineRef), 
            output viPostingID (oiPostingId), 
            output vcPostingOpenRowid (ocRowid), 
            output viPostingVoucher (oiPostingVoucher), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
        if viFcReturnSuper <> 0 and oiReturnStatus >= 0
        then assign oiReturnStatus = viFcReturnSuper.                           
        if viFcReturnSuper < 0 
        then return.
        
        /* Update Additional GL Numbering date */
        if vlIsAddGLNbr
        then do:
            <M-51 run SetNumberingDate
               (input  viPostingID (iiPostingID), 
                input  tYearClosing.YearClosingReoAddGLNbrDate (itNbrDate), 
                output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>
            if viFcReturnSuper <> 0 and oiReturnStatus >= 0
            then assign oiReturnStatus = viFcReturnSuper.                           
            if viFcReturnSuper < 0 
            then return.
        end. /* if vlIsAddGLNbr */
        
        assign vlHeaderCreated = true.                
    end. /* if vlHeaderCreated = false */
    assign vcPostingText =  trim(#T-27'Year-End Closing: PL transfer to BS.':200(56442)T-27#)
           vcPostingText = substring(vcPostingText,1,40,"Character").
    /* Create Postinglines for the transfer PL to BS we did in Add.Upd.PostingTrans */
    for each tPLAmounts:         
        <M-12 run AddStandardPosting
           (input  vcPostingRowid (icPostingtcRowid), 
            input  if tplamounts.tcPLAmountsDivisionCode = '':U then tYearClosing.tcClosingBalanceGLCode else tYearClosing.tcClosingBalanceDivGLCode (icGLCode), 
            input  '':U (icDivisionCode), 
            input  '':U (icCostCentreCode), 
            input  '':U (icCostCentreText), 
            input  '':U (icProjectCode), 
            input  '':U (icProjectText), 
            input  '':U (icIntercoBusinessRelationCode), 
            input  vcCompanyLC (icCurrencyCode), 
            input  if tplamounts.tdPLAmountsLC <= 0 then - tplamounts.tdPLAmountsLC else 0 (idDebitTC), 
            input  if tplamounts.tdPLAmountsLC <= 0 then - tplamounts.tdPLAmountsLC else 0 (idDebitLC), 
            input  if tplamounts.tdPLAmountsCC <= 0 then - tplamounts.tdPLAmountsCC else 0 (idDebitCC), 
            input  0 (idDebitPC), 
            input  if tplamounts.tdPLAmountsLC <= 0 then 0 else tplamounts.tdPLAmountsLC (idCreditTC), 
            input  if tplamounts.tdPLAmountsLC <= 0 then 0 else tplamounts.tdPLAmountsLC (idCreditLC), 
            input  if tplamounts.tdPLAmountsCC <= 0 then 0 else tplamounts.tdPLAmountsCC (idCreditCC), 
            input  0 (idCreditPC), 
            input  0 (idQty), 
            input  vcPostingText (icLineText), 
            input  '':U (icSafText), 
            input  tDefaultSaf (tDefaultSafs), 
            input  {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateType), 
            input  1 (idExchangeRate), 
            input  1 (idExchangeRateScale), 
            output viPostingLineID (oiPostingLineId), 
            input  0 (iiSafStructureId), 
            input  '':U (icSafStructureCode), 
            input  '':U (icAllocationKey), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>                                            
        if viFcReturnSuper <> 0 and oiReturnStatus >= 0
        then assign oiReturnStatus = viFcReturnSuper.                           
        if viFcReturnSuper < 0 
        then return.    
        assign vcPostingText = trim(#T-28'Year-End Closing: PL transfer to BS.':200(56442)T-28#)
               vcPostingText = substring(vcPostingText,1,40,"Character").
        <M-13 run AddStandardPosting
           (input  vcPostingOpenRowid (icPostingtcRowid), 
            input  if tplamounts.tcPLAmountsDivisionCode = '':U then tYearClosing.tcClosingBalanceGLCode else tYearClosing.tcClosingBalanceDivGLCode (icGLCode), 
            input  '':U (icDivisionCode), 
            input  '':U (icCostCentreCode), 
            input  '':U (icCostCentreText), 
            input  '':U (icProjectCode), 
            input  '':U (icProjectText), 
            input  '':U (icIntercoBusinessRelationCode), 
            input  vcCompanyLC (icCurrencyCode), 
            input  if tplamounts.tdPLAmountsLC <= 0 then 0 else tplamounts.tdPLAmountsLC (idDebitTC), 
            input  if tplamounts.tdPLAmountsLC <= 0 then 0 else tplamounts.tdPLAmountsLC (idDebitLC), 
            input  if tplamounts.tdPLAmountsCC <= 0 then 0 else tplamounts.tdPLAmountsCC (idDebitCC), 
            input  0 (idDebitPC), 
            input  if tplamounts.tdPLAmountsLC <= 0 then - tplamounts.tdPLAmountsLC else 0 (idCreditTC), 
            input  if tplamounts.tdPLAmountsLC <= 0 then - tplamounts.tdPLAmountsLC else 0 (idCreditLC), 
            input  if tplamounts.tdPLAmountsCC <= 0 then - tplamounts.tdPLAmountsCC else 0 (idCreditCC), 
            input  0 (idCreditPC), 
            input  0 (idQty), 
            input  vcPostingText (icLineText), 
            input  '':U (icSafText), 
            input  tDefaultSaf (tDefaultSafs), 
            input  {&EXCHANGERATETYPE-ACCOUNTING} (icExchangeRateType), 
            input  1 (idExchangeRate), 
            input  1 (idExchangeRateScale), 
            output viPostingLineID (oiPostingLineId), 
            input  0 (iiSafStructureId), 
            input  '':U (icSafStructureCode), 
            input  '':U (icAllocationKey), 
            output viFcReturnSuper (oiReturnStatus)) in BJournalEntry>                                            
        if viFcReturnSuper <> 0 and oiReturnStatus >= 0
        then assign oiReturnStatus = viFcReturnSuper.                           
        if viFcReturnSuper < 0 
        then return.                      
    end. /* for each tPLAmounts */                                       

    if oiReturnStatus = -98
    then assign oiReturnStatus = 0.