project QadFinancials > class BBudgetLinkCommitment > method DeleteBudgetLinkCommitByBudgetID

Description

delete all budgetlinkcommit records depending on the budgetID


Parameters


icBudgetIDSinputcharacterlist of BudgetIDs
oiReturnStatusoutputintegerReturn status of the method.


Internal usage


unused


program code (program4/bbudgetlinkcommitment.p)

/* first check if the paramters contain some values */
if icBudgetIDS = "":U or icBudgetIDS = ?
then return.

/* Get all BudgetLinks with the BudgetID                                  */
/* pay attention that the parameter icBudgetIDS can contain several IDs ! */
do viCounter= 1 to num-entries(icBudgetIDS,chr(2)):

    /* read the correct Budgetlink record with the budgetID */
    <Q-7 run BudgetLinkCommitByBudgetPOLine (all) (Read) (NoCache)
          (input viCompanyId, (CompanyId)
           input entry(vicounter,icBudgetIDS,chr(2)), (BudgetID)
           input ?, (BudgetWBSID)
           input ?, (POLineID)
           input ?, (BudgetPeriodID)
           output dataset tqBudgetLinkCommitByBudgetPOLine) in BBudgetLinkCommitment >

    find first tqBudgetLinkCommitByBudgetPOLine no-lock no-error.
    if not available tqBudgetLinkCommitByBudgetPOLine
    then return.

    /* concatinate all budgetlinkID to load all the data at once*/
    for each tqBudgetLinkCommitByBudgetPOLine:
        assign vcBudgetLinkIDS = (if vcBudgetLinkIDS = "":U
                                  then string(tqBudgetLinkCommitByBudgetPOLine.tiBudgetLinkCommit_ID)
                                  else vcBudgetLinkIDS + chr(4) + string(tqBudgetLinkCommitByBudgetPOLine.tiBudgetLinkCommit_ID)).
    end.
end.

/* Get all the necessary records with a list of budgetIDS */
<M-8 run DataLoad
          (input  ? (icRowids), 
           input  vcBudgetLinkIDS (icPkeys), 
           input  ? (icObjectIds), 
           input  '' (icFreeform), 
           input  ? (ilKeepPrevious), 
           output viFcReturnSuper (oiReturnStatus)) in BBudgetLinkCommitment>

if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 
then return.

/* set all the records that are read to status D(eleted) */
for each tBudgetLinkCommit:
    assign tBudgetLinkCommit.tc_Status = "D":U.
end.

/* validate the data that will be deleted */
<M-9 run ValidateBC (output viFcReturnSuper (oiReturnStatus)) in BBudgetLinkCommitment>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 
then return.

/*
/* do some additional/external updates if necessary */
<M-10 run AdditionalUpdates (output viFcReturnSuper (oiReturnStatus)) in BBudgetLinkCommitment>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 
then return.
*/

/* commit everything to the Database */
<M-11 run DataSave (output viFcReturnSuper (oiReturnStatus)) in BBudgetLinkCommitment>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus = 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 
then return.