project QadFinancials > class BPosting > method ClearData

Description

Remove contents of all class temp-tables.


Parameters


oiReturnStatusoutputintegerReturn status of the method.


Internal usage


QadFinancials
method BCInvoice.ClearAllData
method BCInvoice.ClearMFPosting
method BCInvoice.ReInitializeEverything
method BCInvoice.ReInitializePostings
method BCInvoice.ReplaceCInvoice
method BDInvoice.ReInitializeEverything
method BPosting.ApiMassDeletePeriodicCostingPostings
method BPosting.ApiMassDeletePeriodicCostingPostingsByDomain
method BPosting.ApiMassReversePeriodicCostingPostings
method BPosting.ApiMassReversePeriodicCostingPostingsByDomain
method BPosting.ApiStdMaintainMultiTT
method BPosting.ApiStdMaintainTT
method BPosting.StdMaintainTT
method BJournalEntry.ApiUpdateJournal
method BJournalEntry.DumpJEForConsolid
method BJournalEntry.GetPostingStatusChange


program code (program/bposting.p)

/* ================================================================ */    
/* Release previously reserved number.                              */
/* Only Release in case of :                                        */
/* - new mode                                                       */
/* - modify mode and the previous journal was not a TRANSIENT layer */
/* Note that in modify mode tc_status is still empty!!!             */
/* ================================================================ */
assign viBlockReturnStatus = 0.
BNUMBERBLOCK: DO :

    for each tposting where
             tPosting.tc_Status         = "N":U or
             (tPosting.tc_Status        <> "N":U and 
              tPosting.tcLayerTypeCode  <> {&LAYERTYPECODE-TRANSIENT}) :

        /* Release Voucher Number only for Matching Daybook */
        <Q-1 run JournalByJournalLayerType (all) (Read) (NoCache)
            (input 0, (JournalId)
             input tPosting.tcJournalCode, (JournalCode)
             input tPosting.Company_ID, (CompanyId)
             input '':U, (LayerTypeCode)
             output dataset tqJournalByJournalLayerType) in BJournal >

        find first tqJournalByJournalLayerType where
                   tqJournalByJournalLayerType.tcJournalCode = tPosting.tcJournalCode
                   no-error.
        if available tqJournalByJournalLayerType and 
                     (tqJournalByJournalLayerType.tcJournalTypeCode = {&JOURNALTYPE-CIREC} or
                      tqJournalByJournalLayerType.tcJournalTypeCode = {&JOURNALTYPE-JOURNALENTRY})
 
        then do:
            /* Start&Open BNumber (AddToTrx=false) as in a loop below we will be calling BNumber repetively and this */
            /* is more performing then using vhFcComponent=?. BNumber will be closed and stopped after the loop      */
            if viBNumberFromBPostingID = 0 or viBNumberFromBPostingID = ?
            then do :
                <I-88 {bFcStartAndOpenInstance
                     &ADD-TO-TRANSACTION   = "false"
                     &CLASS                = "BNumber"}>
            end. /* if viBNumberFromBPostingID = 0 or viBNumberFromBPostingID = ? */

            /* Frre up the number */
            <M-2 run ReleaseNumber
                (input  tPosting.Company_ID (iiCompanyId), 
                 input  tPosting.PostingYear (iiNumbrYear), 
                 input  tPosting.tcJournalCode (icNumbrType), 
                 input  tPosting.PostingVoucher (iiNumbr), 
                 input  viFcCurrentInstanceId (iiInstanceId), 
                 input  vcFcComponentname (icClassName), 
                 output viFcReturnSuper (oiReturnStatus)) in BNumber>
                 
            /*IN CASE NO NUMBER WAS FOUND WE SKIP THE ERROR*/
            if viFcReturnSuper = -4
                then assign viFcReturnSuper = 0.                      
                 
             if viFcReturnSuper < 0 
             then assign viBlockReturnStatus = viFcReturnSuper.
             if viFcReturnSuper < 0
             then Leave BNUMBERBLOCK.
        end. /* if available tqJournalByJournalLayerType */
    end. /* for each tposting */    
END. /* BNUMBERBLOCK */

/* Close&Stop BNumber that is started with a different transaction before the previous loop   */
if viBNumberFromBPostingID <> 0 and viBNumberFromBPostingID <> ?
then do :
    <I-4 {bFcCloseAndStopInstance
         &CLASS           = "BNumber"}>
end. /* if viBNumberFromBPostingID <> 0 and viBNumberFromBPostingID <> ? */

/* Capture errors from within the previous block */
if viBlockReturnStatus <> 0 
then assign oiReturnStatus = viBlockReturnStatus.
if viBlockReturnStatus < 0 
then Return.


<ANCESTOR-CODE>
    
empty temp-table tCommitNumber.

assign vcTemplateLoadedList = "":U.