project QadFinancials > class BBudget > method CreateBudgetVersionFig

Description

Initialize a new record in class table tBudgetVersionFig.


Parameters


ic_ParentRowidinputcharacter= tBudgetVersionFig.tc_ParentRowid
BBudgetoutputdatasetclass dataset, containing only the newly initialized record
oiReturnStatusoutputintegererror status


program code (program/bbudget.p)

    assign oiReturnStatus = -98.

    empty temp-table t_sBudget.
    empty temp-table t_sBudgetCompany.
    empty temp-table t_sBudgetFDS.
    empty temp-table t_sBudgetPeriod.
    empty temp-table t_sBudgetVersion.
    empty temp-table t_sBudgetVersionFig.
    empty temp-table t_sBudgetVersionGLFig.
    empty temp-table t_sBudgetWBS.
    empty temp-table t_sBudgetWBSBusComponent.
    empty temp-table t_sBudgetWBSRoster.
    empty temp-table t_sTransString.
    empty temp-table t_sCustomTable0.
    empty temp-table t_sCustomTable1.
    empty temp-table t_sCustomTable2.
    find first tFcRowidConvert where
               tFcRowidConvert.tcFcOldRowid = ic_ParentRowid and
               tFcRowidConvert.tlFcOk       no-error.
    if available tFcRowidConvert
    then assign ic_ParentRowid = tFcRowidConvert.tcFcNewRowid.

    find tBudgetVersion where
         tBudgetVersion.tc_Rowid = ic_ParentRowid no-error.
    if not available tBudgetVersion
    then do:
        { includes/bfcrun.i
          &PROCEDURE  = "SetMessage"
          &PARAMETERS = "input 'Invalid parent ID':U,
                         input '',
                         input 'tBudgetVersion.tc_Rowid':U,
                         input ic_ParentRowid,
                         input 'S':U,
                         input 3,
                         input ic_ParentRowid,
                         input '',
                         input '',
                         input '',
                         input '',
                         output oiReturnStatus" }
        assign oiReturnStatus = -3.
        return.
    end.

    create tBudgetVersionFig.
    assign tBudgetVersionFig.tc_Rowid  = dynamic-function("GetNumberForNew":U in {&TARGETPROCEDURE})
           tBudgetVersionFig.tc_Status = "N":U.
    { includes/bfcrun.i
      &procedure  = "StartPersistence"
      &parameters = "output vh_persistence,
                     output viFcReturnSuper" }
    if viFcReturnSuper <> 0
    then do:
        assign oiReturnStatus = viFcReturnSuper.
        return.
    end.
    assign tBudgetVersionFig.BudgetVersionFig_ID = dynamic-function ("GetNextValue":U in vh_persistence,"ObjectNumber":U).
    assign tBudgetVersionFig.tc_ParentRowid = tBudgetVersion.tc_Rowid
           tBudgetVersionFig.BudgetVersion_ID = tBudgetVersion.BudgetVersion_ID.
    { includes/bfcrun.i
      &procedure  = "InitialValues"
      &parameters = "input 'BudgetVersionFig':U,
                     output oiReturnStatus" }

    create t_sBudgetVersionFig.
    raw-transfer tBudgetVersionFig to t_sBudgetVersionFig.
    assign t_sBudgetVersionFig.tc_ParentRowid = ic_ParentRowid.