OnlineConsolidationsCalculateBal

Online Consolidations Calculate Balances

Major Business Rule

Object Name: B0900101

Parent DLL: CFIN

Location: Client/Server

Language: C

Functional Description

Purpose

This function is used to calculate an account's balance for the Online Consolidations application.


Setup Notes and Prerequisites


Special Logic

This function can act either of two ways:

1. Can calculate the account balance for one specific account (Most common use).

To accomplish this pass a "Y" in the cBusinessUnitDetail parameter.

2. Can calculate the account balance for one specific account AND all other accounts that are 

underneath this account in Level of Detail across multiple business units. (Used in LOD Online 

Consolidations).

To accomplish this pass the requested roll up LOD in the cRequestedLevelOfDetail parameter, and the 

Account's actual LOD in the cAccountLevelOfDetail and an "N" in the cBusinessUnitDetail parameter.


Please refer to the Data Structure Attachments for detailed instructions on parameter requirements 

and functionality.


Technical Specification


Main BSFN:

Determine Rollup Method

Set F0902 Table Info

Open Account Balances Table (F0902)

If cBusinessUnitDetail = "Y"

   If cPostingEditCode != "N"

      Call Account Balance Calculate

Else

   Fetch record from F092181 based on cAccountID

   If cPostingEditCode != "N"

      Call Account Balance Calculate

   Fetch next record from F092181

   While Fetches from F092181 are valid AND Fetched LOD > cAccountLevelOfDetail

      If Previous PEC = BLANK AND Previous LOD != cAccountLevelOfDetail

         Stop Processing

      If Fetched PEC != "N"

         Call Account Balance Calculate

      Fetch next record from F092181


Account Balance Calculate:

This logic is run for each Ledger Type individually.  All date information is relative to which 

Ledger Type is being processed. i.e. szLedgerType2 uses jdThruDate2, mnFiscalYear2, etc...


Partially set the key to the Account Balances Table (F0902), based on rollup method.

If szLedgerType != BLANK

Complete the key to Account Balances Table (F0902), ledger type specific based on rollup 
method, and calculate that ledger's account balance

Calculate Variances

F0902 Balance Calculate:

This function will calculate the balance for the specified LT.

While F0902 Fetches are valid

   Fetch record from F0902

   If Fetch is valid

 Add ANxx to Accumulated Period Balance

Add ANxx and all other's prior within the Fiscal Year to Accumulated YTD Balance
      Add APYC to Accumulated Balance Forward Amount

      Add APYN to Accumulated Prior Year Net Posting Amount

     

      If cAddBalanceForwardToYTDAmount = "Y"

         Add APYC to the Accumulated YTD Balance

Data Structure

D0900101 - Online Consolidations Calculate Balances

Parameter NameData ItemData TypeReq/OptI/O/Both
cFCLevelOfDetailLDAcharNONENONE

Special Input Expected
Pass the Account Level Of Detail that you are rolling up to, usually the FC field off of the form.


THIS IS A REQUIRED FIELD.


Special Output Returned

^

szFCSubledgerSBLcharNONENONE

Special Input Expected
Pass in the Subledger value to be used when calculating the account balance.  If you do not have the 

value or are unsure of what to pass, then pass an "*".


THIS IS A REQUIRED FIELD.


Special Output Returned

^

cFCSubledgerTypeSBLTcharNONENONE

Special Input Expected
Pass in the Subledger Type value to be used when calculating the account balance.  If you do not have 

the value or are unsure of what to pass, then pass a blank.


THIS IS A REQUIRED FIELD.


Special Output Returned

^

szFCCurrencyCodeCRCDcharNONENONE

Special Input Expected
Pass in the Currency Code value to be used when calculating the account balance.  If you do not have 

the value or are unsure of what to pass, then pass an "*".


THIS IS A REQUIRED FIELD.


Special Output Returned

^

szFCLedgerType1LTcharNONENONE

Special Input Expected
Pass in the first Ledger Type value to be used when calculating the account balance.  If left blank 

no amounts will be calculated for this Ledger Type.


Special Output Returned

^

szFCLedgerType2LTcharNONENONE

Special Input Expected
Pass in the second Ledger Type value to be used when calculating the account balance.  If left blank 

no amounts will be calculated for this Ledger Type.


Special Output Returned

^

szFCLedgerType3LTcharNONENONE

Special Input Expected
Pass in the third Ledger Type value to be used when calculating the account balance.  If left blank 

no amounts will be calculated for this Ledger Type.


Special Output Returned

^

szFCLedgerType4LTcharNONENONE

Special Input Expected
Pass in the fourth Ledger Type value to be used when calculating the account balance.  If left blank 

no amounts will be calculated for this Ledger Type.


Special Output Returned

^

mnBCNextNumberN001MATH_NUMERICNONENONE

Special Input Expected
Pass in the Next Number associated with the Consolidation.  This is used to find the accounts that 

are part of the Consolidation.


THIS IS A REQUIRED FIELD.


Special Output Returned

^

szBCObjectAccountOBJcharNONENONE

Special Input Expected
Pass in the Object Account associated with the Account (AID) that is also being passed.


THIS IS A REQUIRED FIELD.


Special Output Returned

^

szBCSubsidiarySUBcharNONENONE

Special Input Expected
Pass in the Subsidiary associated with the Account (AID) that is also being passed.


THIS IS A REQUIRED FIELD.


Special Output Returned

^

cBCPostingEditCodePECcharNONENONE

Special Input Expected
Pass in the Posting Edit Code associated with the Account (AID) that is also being passed.


THIS IS A REQUIRED FIELD.


Special Output Returned

^

cBCLevelOfDetailLDAcharNONENONE

Special Input Expected
Pass in the Account Level of Detail associated with the Account (AID) that is also being passed.


THIS IS A REQUIRED FIELD.


Special Output Returned

^

szBCAccountIDAIDcharNONENONE

Special Input Expected
Pass the Short Account ID of the Account you are requesting a balance for.


THIS IS A REQUIRED FIELD.


Special Output Returned

^

cVarianceCalculationMethodEV01charNONENONE

Special Input Expected
Pass the appropriate character to initiate Variance Calculations.

("A" - Addition)

("S" - Subtraction) 

("M"  Multiplication)

("D" - Division) 


Special Output Returned

^

cAddBalanceForwardToYTDAmountEV01charNONENONE

Special Input Expected
Pass a "Y" to automatically add the APYC balances to the YTD balances.  The developer should have 

checked the account to see if it falls within the AAI ranges of GLG6 and GLG12 to determine whether or 

not to pass a "Y".  Usually, if the account falls before GLG6 or after GLG12, than you would pass a "Y" 

in this parameter. 


Special Output Returned
^

mnPeriodNumber1PNMATH_NUMERICNONENONE

Special Input Expected
Pass in the Period Number to be used for calculating the account balance  for the first Ledger Type.  

If left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 1 IS POPULATED.


Special Output Returned

^

mnPeriodNumber2PNMATH_NUMERICNONENONE

Special Input Expected
Pass in the Period Number to be used for calculating the account balance  for the second Ledger Type. 

 If left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 2 IS POPULATED.


Special Output Returned

^

mnPeriodNumber3PNMATH_NUMERICNONENONE

Special Input Expected
Pass in the Period Number to be used for calculating the account balance  for the third Ledger Type.  

If left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 3 IS POPULATED.


Special Output Returned

^

mnPeriodNumber4PNMATH_NUMERICNONENONE

Special Input Expected
Pass in the Period Number to be used for calculating the account balance  for the fourth Ledger Type. 

 If left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 4 IS POPULATED.


Special Output Returned

^

mnFiscalYear1FYMATH_NUMERICNONENONE

Special Input Expected
Pass in the Fiscal Year to be used for calculating the account balance  for the first Ledger Type.  

If left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 1 IS POPULATED.


Special Output Returned

^

mnFiscalYear2FYMATH_NUMERICNONENONE

Special Input Expected
Pass in the Fiscal Year to be used for calculating the account balance  for the second Ledger Type.  

If left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 2 IS POPULATED.


Special Output Returned

^

mnFiscalYear3FYMATH_NUMERICNONENONE

Special Input Expected
Pass in the Fiscal Year to be used for calculating the account balance  for the third Ledger Type.  

If left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 3 IS POPULATED.


Special Output Returned

^

mnFiscalYear4FYMATH_NUMERICNONENONE

Special Input Expected
Pass in the Fiscal Year to be used for calculating the account balance  for the fourth Ledger Type.  

If left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 4 IS POPULATED.


Special Output Returned

^

mnCentury1CTRYMATH_NUMERICNONENONE

Special Input Expected
Pass in the Century to be used for calculating the account balance  for the first Ledger Type.  If 

left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 1 IS POPULATED.


Special Output Returned

^

mnCentury2CTRYMATH_NUMERICNONENONE

Special Input Expected
Pass in the Century to be used for calculating the account balance for the second Ledger Type.  If 

left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 2 IS POPULATED.


Special Output Returned

^

mnCentury3CTRYMATH_NUMERICNONENONE

Special Input Expected
Pass in the Century to be used for calculating the account balance for the third Ledger Type.  If 

left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 3 IS POPULATED.


Special Output Returned

^

mnCentury4CTRYMATH_NUMERICNONENONE

Special Input Expected
Pass in the Century to be used for calculating the account balance for the fourth Ledger Type.  If 

left blank no amounts will be calculated for this Ledger Type.


THIS IS A REQUIRED FIELD IF LEDGER TYPE 4 IS POPULATED.


Special Output Returned

^

mnPeriodAmount1AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Period Balance for Ledger Type 1.

^

mnPeriodAmount2AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Period Balance for Ledger Type 2.

^

mnPeriodAmount3AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Period Balance for Ledger Type 3.

^

mnPeriodAmount4AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Period Balance for Ledger Type 4.

^

mnYTDAmount1AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned YTD Balance for Ledger Type 1.

^

mnYTDAmount2AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned YTD Balance for Ledger Type 2.

^

mnYTDAmount3AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned YTD Balance for Ledger Type 3.

^

mnYTDAmount4AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned YTD Balance for Ledger Type 4.

^

mnBalanceForwardAmount1AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Balance Forward (APYC) Balance for Ledger Type 1.

^

mnBalanceForwardAmount2AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Balance Forward (APYC) Balance for Ledger Type 2.

^

mnBalanceForwardAmount3AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Balance Forward (APYC) Balance for Ledger Type 3.

^

mnBalanceForwardAmount4AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Balance Forward (APYC) Balance for Ledger Type 4.

^

mnPriorYearNetPostingAmount1AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Prior Year net Posting (APYN) Balance for Ledger Type 1.

^

mnPriorYearNetPostingAmount2AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Prior Year net Posting (APYN) Balance for Ledger Type 2.

^

mnPriorYearNetPostingAmount3AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Prior Year net Posting (APYN) Balance for Ledger Type 3.

^

mnPriorYearNetPostingAmount4AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Prior Year net Posting (APYN) Balance for Ledger Type 4.

^

mnVarianceAmount1AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Variance of Period 1 Amount and Period 2 Amount.

(Addition       = mnPeriodAmount1 + mnPeriodAmount2)

(Subtraction    = mnPeriodAmount1 - mnPeriodAmount2) 

(Multiplication = mnPeriodAmount1 x mnPeriodAmount2) 

(Division       = mnPeriodAmount1 / mnPeriodAmount2) 

^

mnVarianceAmount2AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Variance of YTD 1 Amount and YTD 2 Amount.

(Addition       = mnYTDAmount1 + mnYTDAmount2)

(Subtraction    = mnYTDAmount1 - mnYTDAmount2) 

(Multiplication = mnYTDAmount1 x mnYTDAmount2) 

(Division       = mnYTDAmount1 / mnYTDAmount2) 

^

mnVarianceAmount3AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Variance of Period 3 and Period 4 Balances.

(Addition       = mnPeriodAmount3 + mnPeriodAmount4)

(Subtraction    = mnPeriodAmount3  mnPeriodAmount4) 

(Multiplication = mnPeriodAmount3 x mnPeriodAmount4) 

(Division       = mnPeriodAmount3 / mnPeriodAmount4) 

^

mnVarianceAmount4AAMATH_NUMERICNONENONE

Special Input Expected

Special Output Returned

Returned Variance of YTD 3 Amount and YTD 4 Amount.

(Addition       = mnYTDAmount3 + mnYTDAmount4)

(Subtraction    = mnYTDAmount3  mnYTDAmount4) 

(Multiplication = mnYTDAmount3 x mnYTDAmount4) 

(Division       = mnYTDAmount3 / mnYTDAmount4) 

^

cBusinessUnitDetailEV01charNONENONE

Special Input Expected
Pass a "Y" if the Business Unit Detail flag is "ON" meaning that the user has requested Business Unit 

Detail.  This in effect will force the BSFN to calculate the account balance only for the account 

requested.  Pass a "N" to allow the function to calculate balances for all accounts of a lower level of 

detail across all business units in the consolidation.


THIS IS A REQUIRED FIELD.


Special Output Returned

^

Related Functions

None

Related Tables

F0902 Account Balances
F092181 Online Consolidation Detail File