project QadFinancials > class BBudget > method BudgetWBSUpdate
Description
This method will update the properties for a single budgetWBS-record. This is done based on the input information.
It will also return a temp-table that contain the records that are updated. Subtbales of the WBS should be maintained on the UI without passing the information to the business-side.
Parameters
icBudgetTcRowid | input | character | BudgetTcRowid |
icBudgetWBSTcRowid | input | character | BudgetWBSTcRowid |
icBudgetWBSBudgetGroupCode | input | character | BudgetWBSBudgetGroupCode |
icBudgetWBSFDSFromCode | input | character | BudgetWBSFDSFromCode |
icBudgetWBSFDSToCode | input | character | BudgetWBSFDSToCode |
icBudgetWBSFDSList | input | character | BudgetWBSFDSList |
icBudgetWBSFDSCode | input | character | BudgetWBSFDSCode |
icBudgetWBSFDSDefault | input | character | BudgetWBSFDSDefault |
icBudgetWBSSafStructureCode | input | character | BudgetWBSSafStructureCode |
icBudgetWBSCostRevenue | input | character | BudgetWBSCostRevenue |
idBudgetWBSPercOfComp | input | decimal | BudgetWBSPercOfComp |
icBudgetWBSOverrunTotal | input | character | icBudgetWBSOverrunTotal |
icBudgetWBSOverrunPeriod | input | character | icBudgetWBSOverrunPeriod |
icBudgetWBSOverrunYTD | input | character | icBudgetWBSOverrunYTD |
icBudgetWBSStatus | input | character | BudgetWBSStatus |
icBudgetWBSCostType | input | character | BudgetWBSCostType |
icUnitCode | input | character | Unit Code |
tNewBudgetWBS | output | temp-table | Temp-table containing the updated BudgetWBS-records |
ilBudgetWBSIsHideOnReport | input | logical | BudgetWBSIsHideOnReport |
ilBudgetWBSIsInvertBase | input | logical | BudgetWBSIsInvertBase |
ilBudgetWBSIsRollup | input | logical | BudgetWBSIsRollup |
ilBudgetWBSIsWithSumLine | input | logical | BudgetWBSIsWithSumLine |
ilBudgetWBSIsPrintDesc | input | logical | BudgetWBSIsPrintDesc |
icBudgetWBSTopicDescription | input | character | |
icBudgetWBSFDSLink | input | character | BudgetWBSFDSLink |
icBudgetWBSCategory | input | character | BudgetWBSCategory |
icBudgetWBSAltCOAGroupCode | input | character | BudgetWBSAltCOAGroupCode |
oiReturnStatus | output | integer | Return status of the method. |
Internal usage
unused
program code (program6/bbudget.p)
/* ========================================================================== */
/* Reset the output temp-tables */
/* ========================================================================== */
empty temp-table tNewBudgetWBS.
/* ========================================================================== */
/* Validate input parameters */
/* ========================================================================== */
if icBudgetTcRowid = ? then assign icBudgetTcRowid = "":U.
if icBudgetWBSTcRowid = ? then assign icBudgetWBSTcRowid = "":U.
if idBudgetWBSPercOfComp = ? then assign idBudgetWBSPercOfComp = 0.
if icBudgetWBSTcRowid = ? then assign icBudgetWBSTcRowid = "":U.
if icBudgetWBSBudgetGroupCode = ? then assign icBudgetWBSBudgetGroupCode = "":U.
if icBudgetWBSFDSFromCode = ? then assign icBudgetWBSFDSFromCode = "":U.
if icBudgetWBSFDSToCode = ? then assign icBudgetWBSFDSToCode = "":U.
if icBudgetWBSFDSList = ? then assign icBudgetWBSFDSList = "":U.
if icBudgetWBSFDSCode = ? then assign icBudgetWBSFDSCode = "":U.
if icBudgetWBSFDSDefault = ? then assign icBudgetWBSFDSDefault = "":U.
if icBudgetWBSSafStructureCode = ? then assign icBudgetWBSSafStructureCode = "":U.
if icBudgetWBSCostRevenue = ? then assign icBudgetWBSCostRevenue = {&BUDGETWBSCOSTREVENUE-COSTREVENUE}.
if icBudgetWBSStatus = ? then assign icBudgetWBSStatus = {&BUDGETWBSSTATUS-ACTIVE}.
if icBudgetWBSCostType = ? then assign icBudgetWBSCostType = {&BUDGETWBSCOSTTYPE-DIRECT}.
if ilBudgetWBSIsHideOnReport = ? then assign ilBudgetWBSIsHideOnReport = false.
if ilBudgetWBSIsInvertBase = ? then assign ilBudgetWBSIsInvertBase = false.
if ilBudgetWBSIsRollup = ? then assign ilBudgetWBSIsRollup = true.
if ilBudgetWBSIsWithSumLine = ? then assign ilBudgetWBSIsWithSumLine = false.
if icBudgetWBSCategory = ? then assign icBudgetWBSCategory = "":U.
if icBudgetWBSAltCOAGroupCode = ? then assign icBudgetWBSAltCOAGroupCode = "":U.
if ilBudgetWBSIsPrintDesc = ? then assign ilBudgetWBSIsPrintDesc = false.
if icBudgetWBSTopicDescription = ? then assign icBudgetWBSTopicDescription = "":U.
if icBudgetWBSFDSLink = ? then assign icBudgetWBSFDSLink = "":U.
if icBudgetTcRowid = "":U
then do:
assign oiReturnStatus = -3
vcMessage = trim(#T-19'You must enter the budget identification (row ID) to update the budget topics.':255(609)T-19#).
<M-1 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1120':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if icBudgetTcRowid = ? */
else do :
find tBudget where
tBudget.tc_Rowid = icBudgetTcRowid and
tBudget.tc_Status <> "D":U
no-lock no-error.
if not available tBudget
then do:
assign oiReturnStatus = -3
vcMessage = trim(substitute(#T-20'Cannot find the budget based on its row ID (&1).':255(448)T-20#,string(icBudgetTcRowid))).
<M-2 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1126':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if not available tBudget */
end. /* not if icBudgetTcRowid = ? */
if icBudgetWBSTcRowid = "":U
then do:
assign oiReturnStatus = -3
vcMessage = trim(#T-21'You must enter the budget topic identification (row ID) for the update of budget topics.':255(610)T-21#).
<M-3 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1127':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if icBudgetWBSTcRowid = "":U */
else do:
find tBudgetWBS where
tBudgetWBS.tc_ParentRowid = tBudget.tc_Rowid and
tBudgetWBS.tc_Rowid = icBudgetWBSTcRowid and
tBudgetWBS.tc_Status <> "D":U
no-lock no-error.
if not available tBudgetWBS
then do:
assign oiReturnStatus = -3
vcMessage = trim(substitute(#T-22'Cannot find the current budget WBS topic based on its row ID &1.':255(450)T-22#,string(icBudgetWBSTcRowid))).
<M-4 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1128':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if not available tBudgetWBS */
end. /* if icBudgetWBSTcRowid = "":U */
/* ==================================================== */
/* No action allowed if the budget is not yet validated */
/* ==================================================== */
if tBudget.BudgetStatus = {&BUDGETSTATUS-INITIAL}
then do:
assign oiReturnStatus = -3
vcMessage = trim(#T-23'You must validate the budget structure before maintaining the WBS.':255(451)T-23#).
<M-5 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1129':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if tBudget.BudgetStatus = {&BUDGETSTATUS-INITIAL} */
/* ========================================== */
/* If no changes are done, then simply return */
/* ========================================== */
if tBudgetWBS.BudgetWBSFDSCode = icBudgetWBSFDSCode and
tBudgetWBS.BudgetWBSFDSList = icBudgetWBSFDSList and
tBudgetWBS.BudgetWBSFDSFromCode = icBudgetWBSFDSFromCode and
tBudgetWBS.BudgetWBSFDSToCode = icBudgetWBSFDSToCode and
tBudgetWBS.BudgetWBSFDSDefault = icBudgetWBSFDSDefault and
tBudgetWBS.tcSafStructureCode = icBudgetWBSSafStructureCode and
tBudgetWBS.tcBudgetGroupCode = icBudgetWBSBudgetGroupCode and
tBudgetWBS.BudgetWBSPercOfComp = idBudgetWBSPercOfComp and
tBudgetWBS.BudgetWBSOverrunTotal = icBudgetWBSOverrunTotal and
tBudgetWBS.BudgetWBSOverrunPeriod = icBudgetWBSOverrunPeriod and
tBudgetWBS.BudgetWBSOverrunYTD = icBudgetWBSOverrunYTD and
tBudgetWBS.BudgetWBSCostRevenue = icBudgetWBSCostRevenue and
tBudgetWBS.BudgetWBSStatus = icBudgetWBSStatus and
tBudgetWBS.BudgetWBSCostType = icBudgetWBSCostType and
tBudgetWBS.tcUnitCode = icUnitCode and
tBudgetWBS.BudgetWBSIsHideOnReport = ilBudgetWBSIsHideOnReport and
tBudgetWBS.BudgetWBSIsInvertBase = ilBudgetWBSIsInvertBase and
tBudgetWBS.BudgetWBSIsWithSumLine = ilBudgetWBSIsWithSumLine and
tBudgetWBS.BudgetWBSIsRollup = ilBudgetWBSIsRollup and
tBudgetWBS.BudgetWBSCategory = icBudgetWBSCategory and
tBudgetWBS.tcAltCOAGroupCode = icBudgetWBSAltCOAGroupCode and
tBudgetWBS.BudgetWBSIsPrintDesc = ilBudgetWBSIsPrintDesc and
tBudgetWBS.BudgetWBSFDSLink = icBudgetWBSFDSLink and
tBudgetWBS.BudgetWBSTopicDescription = icBudgetWBSTopicDescription
then do:
create tNewBudgetWBS.
buffer-copy tBudgetWBS except BudgetWBSSeq to tNewBudgetWBS.
return.
end. /* if */
/* ========================================================== */
/* FDSLinking in not applicable for WBS-Topics of type Total */
/* ========================================================== */
if tBudgetWBS.BudgetFDSType = {&BUDGETFDSTYPE-TOTAL} and
(tBudgetWBS.BudgetWBSFDSCode <> "":U or
tBudgetWBS.BudgetWBSFDSList <> "":U or
tBudgetWBS.BudgetWBSFDSFromCode <> "":U or
tBudgetWBS.BudgetWBSFDSToCode <> "":U or
tBudgetWBS.tcBudgetGroupCode <> "":U or
tBudgetWBS.tcAltCOAGroupCode <> "":U)
then do:
assign oiReturnStatus = -3
vcMessage = trim(substitute(#T-24'You cannot specify COA link information for budget topics of type &1.':255(611)T-24#,trim({&BUDGETFDSTYPE-TOTAL-TR}))).
<M-6 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1130':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if icBudgetWBSSafStructureCode <> "":U and */
/* ========================================================== */
/* SafStructure is only applicable for WBS-Topics of type Saf */
/* ========================================================== */
if icBudgetWBSSafStructureCode <> "":U and
tBudgetWBS.BudgetFDSType <> {&BUDGETFDSTYPE-SAF}
then do:
assign oiReturnStatus = -3
vcMessage = trim(substitute(#T-25'You can only specify the SAF structure for budget topics of COA type &1.':255(612)T-25#,trim({&BUDGETFDSTYPE-SAF-TR}))).
<M-7 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1131':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
return.
end. /* if icBudgetWBSSafStructureCode <> "":U and */
/* ============================================================================== */
/* Validate the BudgetGroup, the FDS-default and the 4 FDS-information parameters */
/* Convert icBudgetWBSBudgetGroupCode into the BudgetGroup_ID */
/* ============================================================================== */
if icBudgetWBSBudgetGroupCode <> "":U then assign viFilledInFDSTopics = viFilledInFDSTopics + 1.
if icBudgetWBSFDSCode <> "":U then assign viFilledInFDSTopics = viFilledInFDSTopics + 1.
if icBudgetWBSFDSList <> "":U then assign viFilledInFDSTopics = viFilledInFDSTopics + 1.
if icBudgetWBSFDSFromCode <> "":U or
icBudgetWBSFDSToCode <> "":U
then assign viFilledInFDSTopics = viFilledInFDSTopics + 1.
if viFilledInFDSTopics > 1
then do:
assign oiReturnStatus = -3
vcMessage = trim(#T-26'You can select only one of the following options: Budget Group, List, Range (from/to), or Wildcard.':255(613)T-26#).
<M-8 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1132':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end. /* if viFilledInFDSTopics > 1 */
/* ========================================================== */
/* Validate BudgetGroup & AlternateCOAGroup and */
/* retrieve corresponding BudgetGroupID & AlternateCOAGroupID */
/* ========================================================== */
<M-43 run BudgetWBSUpdateSub
(input icBudgetWBSAltCOAGroupCode (icBudgetWBSAltCOAGroupCode),
output viUpdRecordAltCOAGroupID (oiUpdRecordAltCOAGroupID),
input icBudgetWBSBudgetGroupCode (icBudgetWBSBudgetGroupCode),
output viUpdRecordBudgetGroupID (oiUpdRecordBudgetGroupID),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper < 0 or (viFcReturnSuper > 0 and oiReturnStatus >= 0)
then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
/* ===================================================================================== */
/* The SafStructure code can only be set on the highest Saf-level */
/* If no problem occurs the assign the SafStructure_ID, SafConceptCode and SafConcept_ID */
/* ===================================================================================== */
if tBudgetWBS.BudgetFDSType = {&BUDGETFDSTYPE-SAF} and
tBudgetWBS.tcSafStructureCode <> icBudgetWBSSafStructureCode
then do :
/* Get the first BudgetFDS (by FDSSeq) of type SAF */
for each tBudgetFDS where
tBudgetFDS.tc_ParentRowid = tBudget.tc_Rowid and
tBudgetFDS.BudgetFDSType = {&BUDGETFDSTYPE-SAF}
no-lock :
if viBudgetFDSSequence > tBudgetFDS.BudgetFDSSeq or
viBudgetFDSSequence = 0
then assign viBudgetFDSSequence = tBudgetFDS.BudgetFDSSeq.
end. /* for each tBudgetFDS where */
/* Check if we are on the highest saf-level; if not, then error */
if tBudgetWBS.BudgetFDSSeq <> viBudgetFDSSequence
then do :
assign oiReturnStatus = -3
vcMessage = trim(substitute(#T-28'The SAF structure information can only be passed on the highest level (&1) in the COA tree.':255(615)T-28#,string(viBudgetFDSSequence))).
<M-11 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1122':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if tBudgetWBS.BudgetFDSSeq <> viBudgetFDSSequence */
/* Define the SafStructure_ID, SafConceptCode and SafConcept_ID */
<Q-12 run SafStructurePrim (all) (Read) (NoCache)
(input ?, (SafStructureID)
input icBudgetWBSSafStructureCode, (SafStructureCode)
output dataset tqSafStructurePrim) in BSafStructure >
find first tqSafStructurePrim where
tqSafStructurePrim.tcSafStructureCode = icBudgetWBSSafStructureCode
no-lock no-error.
if not available tqSafStructurePrim
then do :
assign oiReturnStatus = -3
vcMessage = trim(substitute(#T-29'The SAF structure code (&1) specified for the WBS topic is not defined in the system.':61(616)T-29#,string(icBudgetWBSSafStructureCode))).
<M-13 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1123':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if not av. tqSafStructurePrim */
assign vcUpdRecordSafStructureCode = tqSafStructurePrim.tcSafStructureCode
viUpdRecordSafStructureID = tqSafStructurePrim.tiSafStructure_ID.
<Q-14 run SafConceptCodeByLine (all) (Read) (NoCache)
(input tqSafStructurePrim.tiSafStructure_ID, (SafStructure_ID)
input 1, (SafStructureLineNumber)
input ?, (SafStructureCode)
output dataset tqSafConceptCodeByLine) in BSafStructure >
find first tqSafConceptCodeByLine
no-lock no-error.
if not available tqSafConceptCodeByLine
then do:
assign oiReturnStatus = -3
vcMessage = trim(substitute(#T-30'The system cannot locate the first SAF concept for the SAF structure.':95(617)T-30#,string(icBudgetWBSSafStructureCode))) + chr(10) +
trim(substitute(#T-31'SAF structure ID: &1.':255(618)T-31#,string(tqSafConceptCodeByLine.tiSafConcept_ID))).
<M-15 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input '':U (icFieldName),
input '':U (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1124':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
Return.
end. /* if not av. tqSafConceptCodeByLine */
assign vcUpdRecordSafConceptCode = tqSafConceptCodeByLine.tcSafConceptCode
viUpdRecordSafConceptID = tqSafConceptCodeByLine.tiSafConcept_ID.
end. /* if tBudgetWBS.BudgetFDSType = {&BUDGETFDSTYPE-SAF} and */
/* ================================================================================== */
/* Validation: if the posting-default is filled then it should refer to a valid SAF */
/* (include checking on the Saf-Concept). The entered value should match the FDS */
/* specification or the budgetgroup. */
/* This property in only available to project-budgets and Node of type SAF. */
/* ================================================================================== */
assign vcMessage = "":U.
if icBudgetWBSFDSDefault <> "":U
then FDSVALIDATIONBLOCK: do:
/* ============================ */
/* Check the general properties */
/* ============================ */
if tBudgetWBS.BudgetFDSType <> {&BUDGETFDSTYPE-SAF}
then do :
assign vcMessage = trim(substitute(#T-32'You can only specify a default SAF value (&2) for budget topics of type &1.':255(619)T-32#,trim({&BUDGETFDSTYPE-SAF-TR}),icBudgetWBSFDSDefault)).
Leave FDSVALIDATIONBLOCK.
end. /* if tBudgetWBS.BudgetFDSType <> {&BUDGETFDSTYPE-SAF} */
if tBudget.Project_ID = 0 and tBudget.tcProjectCode = "":U and
tBudget.CostCentre_ID = 0 and tBudget.tcCostCentreCode = "":U
then do :
assign vcMessage = trim(substitute(#T-33'You can only specify adefault SAF value (&1) for project and cost center budgets.':255(620)T-33#,icBudgetWBSFDSDefault)).
Leave FDSVALIDATIONBLOCK.
end. /* if tBudget.Project_ID = 0 and tBudget.tcProjectCode = "":U */
/* ============================ */
/* Check the SAF properties */
/* ============================ */
assign vcSafStructureCodeOfSafCode = (if tBudgetWBS.tcSafStructureCode = icBudgetWBSSafStructureCode then tBudgetWBS.tcSafConceptCode else vcUpdRecordSafConceptCode).
<Q-16 run SafByCodeIDActiveConcept (first) (Read) (NoCache)
(input icBudgetWBSFDSDefault, (SafCode)
input vcSafStructureCodeOfSafCode, (SafConceptCode)
input ?, (SafID)
input ?, (SafIsActive)
input ?, (SafConceptID)
input ?, (BudgetGroupID)
input ?, (BudgetGroupCode)
output dataset tqSafByCodeIDActiveConcept) in BSaf >
find first tqSafByCodeIDActiveConcept no-lock no-error.
if not available tqSafByCodeIDActiveConcept
then do:
assign vcMessage = trim(substitute(#T-34'Invalid default SAF value: &1.':255(621)T-34#,icBudgetWBSFDSDefault)).
Leave FDSVALIDATIONBLOCK.
end. /* if not available tqSafByCodeIDActiveConcept */
if vcUpdRecordSafConceptCode <> "":U and
vcUpdRecordSafConceptCode <> ? and
tqSafByCodeIDActiveConcept.tcSafConceptCode <> vcUpdRecordSafConceptCode
then do:
assign vcMessage = trim(substitute(#T-35'The SAF concept (&1) of the default SAF value (&2) differs from the SAF concept of the topic node (&3).':255(622)T-35#,(if tqSafByCodeIDActiveConcept.tcSafConceptCode = ? then "?":U else tqSafByCodeIDActiveConcept.tcSafConceptCode),icBudgetWBSFDSDefault,(if vcUpdRecordSafConceptCode = ? then "?":U else vcUpdRecordSafConceptCode))).
Leave FDSVALIDATIONBLOCK.
end. /* if tqSafByCodeIDActiveConcept.tcSafConceptCode <> vcUpdRecordSafConceptCode */
if tqSafByCodeIDActiveConcept.tlSafIsActive <> true
then do:
assign vcMessage = trim(substitute(#T-36'The default SAF value (&1) is not active.':255(623)T-36#,icBudgetWBSFDSDefault)).
Leave FDSVALIDATIONBLOCK.
end. /* if tqSafByCodeIDActiveConcept.tcSafConceptCode <> vcUpdRecordSafConceptCode */
/* ==================================================== */
/* Check the FDS-Link properties of the PostingDefault */
/* ==================================================== */
if icBudgetWBSBudgetGroupCode <> "":U and
tqSafByCodeIDActiveConcept.tcBudgetGroupCode <> icBudgetWBSBudgetGroupCode
then do:
assign vcMessage = trim(substitute(#T-37'The budget group (&1) of the default SAF value (&2) differs from the budget group of the topic node (&3).':255(624)T-37#,(if tqSafByCodeIDActiveConcept.tcBudgetGroupCode = ? then "?":U else tqSafByCodeIDActiveConcept.tcBudgetGroupCode),icBudgetWBSFDSDefault,(if icBudgetWBSBudgetGroupCode = ? then "?":U else icBudgetWBSBudgetGroupCode))).
Leave FDSVALIDATIONBLOCK.
end. /* if icBudgetWBSBudgetGroupCode <> "":U and */
if icBudgetWBSFDSCode <> "":U and
not icBudgetWBSFDSDefault matches icBudgetWBSFDSCode
then do:
assign vcMessage = trim(substitute(#T-38'The COA wildcard (&1) does not match the default SAF value (&2).':255(625)T-38#,icBudgetWBSFDSCode,icBudgetWBSFDSDefault)).
Leave FDSVALIDATIONBLOCK.
end. /* if icBudgetWBSFDSCode <> "":U and */
if icBudgetWBSFDSList <> "":U and
lookup(icBudgetWBSFDSDefault,icBudgetWBSFDSList) = 0
then do:
assign vcMessage = trim(substitute(#T-39'The COA list (&1) does not contain the default SAF value (&2).':255(626)T-39#,icBudgetWBSFDSList,icBudgetWBSFDSDefault)).
Leave FDSVALIDATIONBLOCK.
end. /* if icBudgetWBSFDSList <> "":U and */
if (icBudgetWBSFDSFromCode <> "":U or
icBudgetWBSFDSToCode <> "":U) and
(icBudgetWBSFDSDefault < icBudgetWBSFDSFromCode or
icBudgetWBSFDSDefault > icBudgetWBSFDSFromCode)
then do:
assign vcMessage = trim(substitute(#T-40'The COA range (from &2 to &3) does not contain the default SAF value (&1).':255(627)T-40#,icBudgetWBSFDSDefault,icBudgetWBSFDSFromCode,icBudgetWBSFDSToCode)).
Leave FDSVALIDATIONBLOCK.
end. /* if icBudgetWBSFDSList <> "":U and */
end. /* FDSVALIDATIONBLOCK if icBudgetWBSFDSDefault <> "":U */
if vcMessage <> "":U
then do :
assign oiReturnStatus = -3.
<M-17 run SetMessage
(input vcMessage (icMessage),
input '':U (icArguments),
input 'tBudgetWBS.BudgetWBSFDSDefault':U (icFieldName),
input icBudgetWBSFDSDefault (icFieldValue),
input 'E':U (icType),
input 3 (iiSeverity),
input '':U (icRowid),
input 'QADFIN-1125':U (icFcMsgNumber),
input '' (icFcExplanation),
input '' (icFcIdentification),
input '' (icFcContext),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
end. /* if vcMessage */
/* ============================================================= */
/* Store an indiciation if the SafStructureCode has been changed */
/* ? : no change (check further on in this method) */
/* ============================================================= */
if tBudgetWBS.BudgetFDSType = {&BUDGETFDSTYPE-SAF} and
tBudgetWBS.tcSafStructureCode <> vcUpdRecordSafStructureCode
then assign vcNewSafStructureCode = vcUpdRecordSafStructureCode.
else assign vcNewSafStructureCode = ?.
/* ==================================================================== */
/* Change the WBSCode, set the BudgetWBS-record as changed and create a */
/* a corresponding output record and mark it as chaged as well */
/* ==================================================================== */
assign tBudgetWBS.tc_Status = (if tBudgetWBS.tc_Status = "":U then "C":U else tBudgetWBS.tc_Status)
tBudgetWBS.BudgetWBSFDSCode = icBudgetWBSFDSCode
tBudgetWBS.BudgetWBSFDSList = icBudgetWBSFDSList
tBudgetWBS.BudgetWBSFDSFromCode = icBudgetWBSFDSFromCode
tBudgetWBS.BudgetWBSFDSToCode = icBudgetWBSFDSToCode
tBudgetWBS.BudgetWBSFDSDefault = icBudgetWBSFDSDefault
tBudgetWBS.tcBudgetGroupCode = icBudgetWBSBudgetGroupCode
tBudgetWBS.BudgetGroup_ID = viUpdRecordBudgetGroupID
tBudgetWBS.BudgetWBSOverrunTotal = icBudgetWBSOverrunTotal
tBudgetWBS.BudgetWBSOverrunPeriod = icBudgetWBSOverrunPeriod
tBudgetWBS.BudgetWBSOverrunYTD = icBudgetWBSOverrunYTD
tBudgetWBS.BudgetWBSPercOfComp = idBudgetWBSPercOfComp
tBudgetWBS.BudgetWBSCostRevenue = icBudgetWBSCostRevenue
tBudgetWBS.BudgetWBSStatus = icBudgetWBSStatus
tBudgetWBS.BudgetWBSCostType = icBudgetWBSCostType
tBudgetWBS.tcUnitCode = icUnitCode
tBudgetWBS.BudgetWBSIsHideOnReport = ilBudgetWBSIsHideOnReport
tBudgetWBS.BudgetWBSIsInvertBase = ilBudgetWBSIsInvertBase
tBudgetWBS.BudgetWBSCategory = if icBudgetWBSCategory = "" or icBudgetWBSCategory = ?
then {&BUDGETWBSCATEGORY-ASSET}
else icBudgetWBSCategory
tBudgetWBS.BudgetWBSIsWithSumLine = ilBudgetWBSIsWithSumLine
tBudgetWBS.BudgetWBSIsRollup = ilBudgetWBSIsRollup
tBudgetWBS.AltCOAGroup_ID = viUpdRecordAltCOAGroupID
tBudgetWBS.tcAltCOAGroupCode = icBudgetWBSAltCOAGroupCode
tBudgetWBS.BudgetWBSIsPrintDesc = ilBudgetWBSIsPrintDesc
tBudgetWBS.BudgetWBSFDSLink = icBudgetWBSFDSLink
tBudgetWBS.BudgetWBSTopicDescription = icBudgetWBSTopicDescription.
if vcNewSafStructureCode <> "":U and
vcNewSafStructureCode <> ?
then assign tBudgetWBS.SafStructure_ID = viUpdRecordSafStructureID
tBudgetWBS.SafConcept_ID = viUpdRecordSafConceptID
tBudgetWBS.tcSafStructureCode = vcUpdRecordSafStructureCode
tBudgetWBS.tcSafConceptCode = vcUpdRecordSafConceptCode.
create tNewBudgetWBS.
buffer-copy tBudgetWBS except BudgetWBSSeq to tNewBudgetWBS.
/* ========================================================================================= */
/* If the SafStructureCode has been changed for a SAF-node then we call submethod that will */
/* update the SafStructureCode and SafConceptCode for the underlaying nodes and reset fields */
/* BudgetWBSFDSFromCode, BudgetWBSFDSToCode, BudgetWBSFDSCode, BudgetWBSFDSList and */
/* BudgetWBSFDSDefault. We will also return the updated records to the caller of this method */
/* ========================================================================================= */
if vcNewSafStructureCode <> "":U and
vcNewSafStructureCode <> ?
then do :
empty temp-table tNewMBudgetWBS.
<M-42 run BudgetWBSUpdateSAFChilds
(input tBudgetWBS.tc_ParentRowid (icBudgetTcRowid),
input tBudgetWBS.BudgetWBS_ID (iiParentBudgetWBSID),
input vcNewSafStructureCode (icSafStructureCode),
input 2 (iiSafStructureLevel),
output viFcReturnSuper (oiReturnStatus)) in BBudget>
if viFcReturnSuper <> 0 then assign oiReturnStatus = viFcReturnSuper.
if oiReturnStatus < 0 then return.
for each tNewMBudgetWBS:
create tNewBudgetWBS.
buffer-copy tNewMBudgetWBS to tNewBudgetWBS.
end. /* for each tNewMBudgetWBS */
end. /* if vcNewSafStructureCode <> ? */