project QadFinancials > class BAPMatching > method ExitInstance

Description

This method can be extended with code to execute when an instance of a business class is stopped.

Standard functionality in this method is
- Clean up instance data in the fcInstance table.
- Create or update a draft instance if applicable.

plus transaction handling
- Remove the instance from the transaction if it was added to a transaction in InitInstance.
- Abort the transaction if one was started from inside the business code.

PreCondition

This method is executed when :
- A business instance is stopped (release object + delete instance data)
(icDraftReference = "" + viCurrentDraftInstanceId = 0)
- A business instance is saved as a draft (release object + create draft)
(icDraftReference <> "")
- A draft instance is stopped (release object, delete copy of draft, release original draft)
(icDraftReference = "" + viCurrentDraftInstanceId <> 0)

This method is NOT run when a business instance is only closed (release object + keep instance data).


Parameters


icDraftReferenceinputcharacterDescription for the draft instance.
This parameter will have a value when creating a draft instance.
icDraftFormNameinputcharacterThis parameter will have a value when creating a draft instance.
ilDraftIsSharedinputlogicalThis parameter will have a value when creating a draft instance.
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program/bapmatching.p)

<ANCESTOR-CODE>

/* If the instance contains uncommitted tAPMatching records, do not wait for */
/* housekeeping to release the reserved number. Release it now.              */
for each tAPMatching where
         tAPMatching.tc_Status         = "N":U and
         tAPMatching.tiPostingVoucher <> 0     and
         tAPMatching.tiPostingVoucher <> ?:
    assign vhFcComponent = ?.
    <M-23 run ReleaseNumber
       (input  viCompanyId (iiCompanyId), 
        input  tAPMatching.tiPeriodYear (iiNumbrYear), 
        input  tAPMatching.tcJournalCode (icNumbrType), 
        input  tAPMatching.tiPostingVoucher (iiNumbr), 
        input  viFcCurrentInstanceId (iiInstanceId), 
        input  vcFcComponentName (icClassName), 
        output viFcReturnSuper (oiReturnStatus)) in BNumber>
    if viFcReturnSuper <> 0 and
       viFcReturnSuper <> -4 /* -4 means an invalid read : thus the number-record does not yet even exists */
    then assign oiReturnStatus = viFcReturnSuper.
end. /* for each tAPMatching */