Académique Documents
Professionnel Documents
Culture Documents
HFM
Objectives
This training module intends to cover :
Recap HFM Dimensional Concepts
Overview of HFM Rules
Types of Rule
Basics of HFM Rule writing Syntax
Basics of VB Scripting
Best Practices in Rule Writing
Important rules like Calculation, Translation and
Consolidation
Examples of HFM rule writing ( Business Cases)
Oct 4, 2016
HFM
Summary Slide
HFM Dimensional Recap
Rules Overview
Constants and Variables
Objects and Functions
Rules Expression
Conditional Statements
Sub Procedures and Functions
Use of Loops
Movement of Balance Sheet
Translation Rules
Consolidation Rules
Oct 4, 2016
HFM
HFM Introduction
Oct 4, 2016
HFM
HFM Dimensions
Scenario
Intercompany
Partner
Year
Eight Standard
Account
Period
Dimensions
Value
View
Entity
Custom1
Four Custom
Dimensions
Custom2
Custom3
Custom4
Oct 4, 2016
HFM
Calculate data
Load and
add data
Adjust data
Translate
& Consolidate
Lock data
Approve data
Oct 4, 2016
HFM
Rules Overview
Oct 4, 2016
HFM
Calculations
Allocations
Simple and Complex Allocations - Rules Needed
Data Entry
Data Entry Restriction at a Base Entity Level Rules needed
Data Entry in a Parent Entity Rules Needed
Oct 4, 2016
HFM
Types of Rules
Calculation
Transactions
Dynamic
Calculations
Translation
HFM
Rules
Input
Allocation
Consolidation
No Input
Oct 4, 2016
HFM
Calculation Rules
Calculation
Translation
Allocation
Consolidation
Input
No Input
Dynamic
Calculations
Transactions
10
Oct 4, 2016
HFM
Translation Rules
Calculation
Translation
Allocation
Consolidation
Input
No Input
Dynamic
Calculations
Transactions
11
Oct 4, 2016
HFM
Allocation Rules
Calculation
Translation
Allocation
Consolidation
Input
No Input
Dynamic
Calculations
Transactions
12
Oct 4, 2016
HFM
Consolidation Rules
Calculation
Translation
Allocation
Consolidation
Input
No Input
Dynamic
Calculations
Transactions
Consolidation rules are only active when the application setting for
ConsolidationRules is enabled. It is thought that custom consolidation rules
will be required
13
Oct 4, 2016
HFM
Input Rules
Calculation
Translation
Allocation
Consolidation
Input
No Input
Dynamic
Calculations
Transactions
Input rules enables the data to be entered at the Parent Entity level
Only the <Entity Currency> value dimension is supported for the Input Rules
For the Adjustments Value Dimension, only the journal data can be entered.
The rest of the value dimension members are rolled up.
14
Oct 4, 2016
HFM
No Input Rules
Calculation
Translation
Allocation
Consolidation
Input
No Input
Dynamic
Calculations
Transactions
No Input rules prevent the data to be entered at the Base Entity Level.
By default the data can be entered at lowest level intersection for the Base
Entity
15
Oct 4, 2016
HFM
16
Translation
Allocation
Consolidation
Input
No Input
Dynamic
Calculations
Transactions
Oct 4, 2016
HFM
Transaction Rules
Calculation
Translation
Allocation
Consolidation
Input
No Input
Dynamic
Calculations
Transactions
17
Oct 4, 2016
HFM
Translation
Allocation
18
Consolidation
Input
No Input
Dynamic
Calculations
Transactions
Oct 4, 2016
HFM
Sub Calculate()
<All calculate rules are displayed here.>
End Sub
Sub Dynamic()
<All dynamic rules are displayed here.>
End Sub
Sub Translate()
<All translate rules are displayed here.>
End Sub
Sub Allocate()
<All allocation rules are displayed here.>
End Sub
Example
Sub Calculate ( )
<< Vb Script Statements>>
End Sub
Sub NoInput()
<All no input rules are displayed here.>
End Sub
Sub Consolidate()
<All consolidate rules are displayed here.>
End Sub
Sub Input
<All input rules are displayed here.>
End Sub
Sub Transactions()
<All transactions rules are displayed here.>
End Sub
19
Oct 4, 2016
HFM
20
Oct 4, 2016
HFM
21
Oct 4, 2016
HFM
Constants
22
Oct 4, 2016
HFM
23
Oct 4, 2016
HFM
Simplified Expression
HS.Exp "A#A140000_C.C2#NetIncome." & cAllNonesXC2XC4 & ".W#YTD =
A#PT950." & cAllTopsXC4 & ".W#YTD
* Reference: Astellas Rule file
24
Oct 4, 2016
HFM
Variables
Variables are temporary placeholders used in VB Scripts
Increases performance and makes the code less complex
Variables can be used only in the Sub procedure in which they
are created.
Can be declared on the fly
Declared explicitly using Dim Statements
25
Oct 4, 2016
HFM
26
vPOVScenario = HS.Scenario.Member()
vPOVEntity = HS.Entity.Member()
vPOVValue = HS.Value.Member()
vPOVYear = HS.Year.Member()
vPOVPeriod = HS.Period.Member()
vPOVPeriodNumber = HS.Period.Number()
vPOVView = HS.Scenario.DefaultView("")
vPOVDefCurrency = HS.Entity.DefCurrency("")
vPOVFreq = HS.Scenario.DefaultFreq("")
Oct 4, 2016
HFM
27
Oct 4, 2016
HFM
e.g. Hs.Account.IsICP
The above syntax retrieves the value True or False depending on the fact that the
Account is marked ICP or not
Dots are used to separate the objects from other objects or functions
28
Oct 4, 2016
HFM
Functions of HS
ABSExp
Alloc
CalcStatus
Clear
Con
Multiplies the data with a factor and put the data into [Elimination] or [Proportion]
Exp
Executes a expression and puts data into destination POV from Source POV
Dynamic
GetCell
GetCellNoData
Gets the data from the cell and indicates if there is no data
GetCellRealData
Gets the data from the cell and indicates if there is real data
Input
NoInput
ContainsCellText
OpenDataUnit
SetData
Trans
TransPeriodic
*P.S. This slide does not represent the complete set of Functions
29
Oct 4, 2016
HFM
C1...4 Top
IsBase
IsCalculated
IsChild
IsConsolidated
IsDescendant
IsICP
List
NumBase
NumChild
PlugAccount
UD1...3
ValidationAccount
*P.S. This slide does not represent the complete set of Functions
30
Oct 4, 2016
HFM
AllowAdjsFromChildre
n
Determines if the journal postings are allowed from children for the member
DefCurrency
Holding
IsBase
IsChild
IsDescendant
IsICP
SecurityAsPartner
SecurityClass
UD1...3
*P.S. This slide does not represent the complete set of Functions
31
Oct 4, 2016
HFM
DefaultFreq
DefaultView
Period
IsFirst
IsLast
Number
Custom1..4
SwitchSign
Determines if the debit/credit sign are reversed for a specified custom member
SwitchType
Determines if the account types are switched for a specified custom member
*P.S. This slide does not represent the complete set of Functions
32
Oct 4, 2016
HFM
Entity Dimension
Common Across
Custom Dimensions,
Account Dimensions
Entity
List
SecurityClass
Account
Common Across
Custom
Scenario
IsICP
Common Across
Account
Entity
*P.S. This slide does not represent the complete set of Functions
33
Oct 4, 2016
HFM
Hs.OpenDataUnit Function
Data Units are all the intersections which have data for a given POV
Function HS.OpenDataUnit is used to open the set of intersections
which have data
The HS.OpenDataUnit functions can call the data set for Account,
Customs and ICP dimension
The dimensions omitted in the syntax would be included in the data set
for all the base members
e.g. HS.OpenDataUnit (A#Sales)
This would open the data set for all the intersections for which the
Account Sales has data. The omitted dimensions of Custom and
ICP would be included for all base members in the above example.
34
Oct 4, 2016
HFM
Syntax of HS.OpenDataUnit
Set Command is used to open the data unit
Set MyDataUnit = HS.OpenDataUnit("S#Actual.A#Returns.Y#Prior") //OpenDataUnit
function is used to get all the data for Returns Account member for prior year for the
Actual Scenario
LNumItems = MyDataUnit.GetNumItems //GetNumItems function is used to fetch the
number of records (count) in the variable LNumItems
For i=0 to LNumItems 1 // Start of For loop
Call MyDataUnit.GetItem(i, vAcc, vICP, vC1, vC2, vC3,vC4,vData) //Intersection is
retrieved and i is used as an index. The dimensions members and the data are stored in
the variables (vAcc,vICP,.)
IF HS.Custom1.UD1(vC1) = 123 Then // For the given intersection, checks the UD1 of
custom1 member
HS.Exp A#Returns.C2# &vC2& .C3# &vC3& = &vData& *1.10 //Calculation
End If //End of If Statement
Next // End of For loop
35
Oct 4, 2016
HFM
Rules Expression
36
Oct 4, 2016
HFM
Rule Expression
EXP Function
EXP function is used to insert data from one account into another
account
EXPs argument contains the account to be set and the account
from which the value is retrieved
Hs.Exp Destination = Source
The destination account in the LHS is assigned the value of
the source in RHS
Example of Hs.Exp
HS.Exp "A#Sales = A#Units * A#Price"
*LHS Left Hand Side
*RHS Right Hand Side
37
Oct 4, 2016
HFM
38
Oct 4, 2016
HFM
39
Oct 4, 2016
HFM
40
Oct 4, 2016
HFM
41
Oct 4, 2016
HFM
42
Oct 4, 2016
HFM
Adding Comments
43
Oct 4, 2016
HFM
Conditional Statements
44
Oct 4, 2016
HFM
45
Oct 4, 2016
HFM
46
Oct 4, 2016
HFM
//Test Expression
47
Oct 4, 2016
HFM
48
Oct 4, 2016
HFM
Sub Procedures
Organizes the rule file into logical sub programs
Reduces the complexity of rule file
Helps in troubleshooting
Sub routines can be called multiple times
Sub Calculate
...
Call Opening Balance()
End Sub
Sub Opening Balance ()
End Sub
49
Oct 4, 2016
HFM
Sub PerUnit_Exp_Calc(PerUnitCost,WSVolume)
50
Oct 4, 2016
HFM
Use of Functions
Sub Procedures may or may not return values to the calling procedure.
Procedures can return multiple values.
Functions can return only one value as result, of the operation
(mathematical or logical) it performs, to the calling procedure.
Sub Calculate()
// Calculate routine
Function PerUnit_Calc(WSVolume)
// Function PerUnit_Calc
51
//End of Function
Oct 4, 2016
HFM
Use of Loops
52
Oct 4, 2016
HFM
For Counter = 1 to 10
..
Block of Statements
.
Next
Example:
For vPer = 0 to 11
NetAggrCOS = NetAggrCOS + HS.GetCell("A#CostOfSales.W#Periodic.P#Cur-"&vPer)
vPer = vPer + 1
Next
53
Oct 4, 2016
HFM
Do While Loop
This loop is executed till the condition is met.
Condition is given using the While Syntax.
Syntax
Do While Condition
...
...
Loop
Example
The statements inside the loop run while the value of myNum is 10 or less.
myNum = 0
Do While myNum < 11
myNum = myNum + 1
Loop
54
Oct 4, 2016
HFM
Rule Requirement:
Identify the accounts which have closing balances based on UD1 (User
Defined Attribute)
Copy the calculated closing balance from ClosingCalc(C2 Dimension) to a
member called Closing(C2 Dimension)
55
Oct 4, 2016
HFM
56
Oct 4, 2016
HFM
Go to Next Account
Last
Account?
End
57
Oct 4, 2016
HFM
'
'
'*******************************************************************
Sub CopyCalculatedClosing()
Dim vAccount, vAccountsList
' Uses dynamic member list which reads UD1 attribute and checks for CALC_CLOSING string
vAccountsList = HS.Account.List("", "Closing Is Calculated)
For Each vAccount In vAccountsList
//Use of variables
//Loop End
//End of Program
'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
58
Oct 4, 2016
HFM
Rule Requirement:
To bring forward the Opening Balances
Calculate the current opening balances from prior year end
Calculate the opening balance from prior period closing.
59
Oct 4, 2016
HFM
60
Oct 4, 2016
HFM
WorkFlow
N
Is year
the first
year of
the
applicatio
n?
Y
No Calculation
Is
period
the first
period
of the
year?
For Selected BS
Items for which the
opening Balances
are derived from the
last period of prior
year
For opening
Balances derived
from prior period.
Y
Carry forward the closing
balances of the last period of the
prior year
61
Oct 4, 2016
HFM
HFM Rule
'*******************************************************************
' () Bring Forward Opening Balances //Explanation of Calculation using Comments
'
'
'*******************************************************************
If HS.Year.IsFirst() = False Then
//Start of IF Statement
// Transfer of prior year and prior period closing balances to current opening balances
HS.Exp "C2#OpeningYr = C2#Closing.Y#Prior.P#Last.V#<Entity Curr Total>.S#ACT
//Calculation
//Nested If Condition
//End of Nested If
End If
End If 'HS.Year.IsFirst() = False
// End of IF statement
'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
' END - Bring Forward Opening Balances
'*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*-*
62
Oct 4, 2016
HFM
Best Practices
Declaration
Constants and Variables should begin with a identifier
e.g. vEntity, vScenario, ALL_TOPS ( Here v is used to
identify the variables and the Constant ALL_TOPS is
declared in capital letters
63
Oct 4, 2016
HFM
Best Practices.contd
' Function calls MUST use brackets even when there are no
parameters e.g.'
nParam = FunctionWithNoParams()
Not
nParam = FunctionWithNoParams
64
Oct 4, 2016
HFM
Best Practices.Contd
65
Oct 4, 2016
HFM
Best Practices.contd
66
Oct 4, 2016
HFM
67
Oct 4, 2016
HFM
Movement Accounts
68
Fixed Assets
Depreciation
Capital Expenditure
Currency Translation Adjustments
Oct 4, 2016
HFM
69
Oct 4, 2016
HFM
70
Oct 4, 2016
HFM
71
Oct 4, 2016
HFM
72
Oct 4, 2016
HFM
73
Oct 4, 2016
HFM
Calculated Member
Rules are used to calculate the Foreign Exchange Adj Values
74
Oct 4, 2016
HFM
// The foreign exchange and closing balance is translated using the closing rate
HS.EXP "C4#ForeignExchange = C4#ClosingBalance C4#OpeningBalance-C4#IncreasesC4#Movement+C4#Decreases
LC
Exchange Rate
Translated
Values
CTA
Opening
100
1.5
150
150
Increases
30
1.4
42
42
Decreases
-10
1.4
-14
-14
Movement
1.4
11.2
11.2
1.5
1.5
192
CTA
Closing
75
128
ForeignExchange
= 192 - 189.2 = 2.8
189.2
Oct 4, 2016
HFM
Advantages
Movement defined in Customs can be attached with multiple
accounts
Usage of movement in Customs will lead to minimum hard
coding in the rules as these are not account specific
Most of the information is calculated
Easy from a maintenance perspective
76
Oct 4, 2016
HFM
Translation Rules
77
Oct 4, 2016
HFM
Translation Methods
78
Oct 4, 2016
HFM
79
Oct 4, 2016
HFM
Use of Exchange rate ( Average or Closing Rate ) is decided by the business requirements
Metadata has to be configured to use these exchange rates for the translation process
For Flow Accounts ( Revenue and Expense) Average rate is used by the system for
translation if it is defined in the DefaultRateForFlow property in the Application Settings
For Balance Accounts( Asset and Liability) Closing rate is used by the system for
translation if it is defined in the DefaultRateForBalance property in the Application Settings
Type of Translation is decided by the PVA setting in the Application Settings
ECT (<Entity Currency Total>) is translated and the translated values sit in PC(<Parent
Currency>).
80
Oct 4, 2016
HFM
Sub Calculate()
If HS.Value.IsTransCur Then
...
...
End If
End Sub
If you add a translation rule for an account to the Sub Translate procedure, the
translation rule overrides the default translation for the account.
All accounts for which rules do not exist in the Sub Translate procedure are
translated using the default translation.
81
Oct 4, 2016
HFM
Translation Functions
HS.Trans
HS.Trans("DestPOV","SourcePOV","Rate1","Rate2")
82
Oct 4, 2016
HFM
DestPOV
The destination point of view. The destination can be any combination of Account,
Custom1...4, or ICP members. For each unspecified dimension, the system writes
to all valid members of the dimension. For each specified dimension, the system
writes to the specified member only.
SourcePOV
The source point of view. The source can be any combination of dimensions. If the
Account, Custom1...4, and ICP dimensions are unspecified, the system uses the
same member as the Destination member. If the Scenario, Year, Period, and Entity
dimensions are not specified, the system uses the current members. If the Value
dimension is not specified, the system uses the Entity Curr Total member. If
SourcePOV is left blank, the system uses the destination point of view as the
source point of view.
HS.Trans "C1#Movement","","A#AvgRate",""
Rate1
The exchange rate. The rate can be a constant, an exchange rate account, or a
specific cell.
Rate2
83
Oct 4, 2016
HFM
84
1.
2.
3.
4.
5.
Oct 4, 2016
HFM
Let us assume cash Balance for ABC is 500 for Jan and Feb
- Exchange rate differences caused the difference in the translated values.
JAN
FEB
CASH ( PC)
750
800
EOM Rate
1.5
1.6
CASH (ECT)
500
500
85
Oct 4, 2016
HFM
Source Account is translated using Rate 1 i.e. EOM Rate for Feb
500*1.6 = 800
Source Account is translated using Rate 2 i.e. Prior EOM Rate for Jan
500*1.5 = 750
Difference of translated value goes to Destination Account EXCH_DIFF.
EXCH_DIFF = 50 (800 750 )
86
Oct 4, 2016
HFM
Consolidation Rules
87
Oct 4, 2016
HFM
Consolidation Process
88
Oct 4, 2016
HFM
Consolidation Functions
PCon
Puts value in the Proportion and Elimination. The Con function multiplies the
value of the Parent Total member by a specified factor and updates either the
Proportion member or the Elimination member of the Value dimension with the
result.
Con
89
Oct 4, 2016
HFM
90
1.
2.
3.
4.
For Elimination
IsICP of Elim accounts should be checked
Plug should be specified
ICP Entities should be defined
Elimination happens at the first common parent
5.
We cannot specify the Source functions in the Con function. It is always the
<Parent Total> Member. The Con function is used in conjunction with the
OpenDataUnit function, and the source account for Con is always the
account for the current item in the data unit.
Oct 4, 2016
HFM
Consolidation Procedure
Sub Consolidate ( )
'****** Default Consolidation ******
Set MyDataUnit = HS.OpenDataUnit("")
lNumItems = MyDataUnit.GetNumItems
For i = 0 to lNumItems-1
vPlug = HS.Account.PlugAcct(strAcc)
4
5
8
End If
End If
Next
'****** Method Specific Consolidation Rules ****** - (For Specific Consolidation Methods)
Select Case Method
Case "AFFILIATE"
Case "SUBSIDIARY
......
End Sub( )
91
Oct 4, 2016
HFM
Consolidation Procedure
Steps
1.
Set MyDataUnit = HS.OpenDataUnit("") Opens the data unit for the current POV and stores in the
Variable MyDataUnit
2.
3.
For i = 0 to lNumItems-1Creates a for loop for till the last record of the data unit is processed.
4.
5.
6.
HS.Con "", HS.Node.PCon(""), " HS.Node.Pcon() is the multiplication factor of the HS.Con
Function. It Picks the consolidation percentage of the current Member.Since nothing is specified in the
HS.Con Destination POV, the default destination is Proportion .
7.
8.
9.
92
HS.Con "V#[Elimination]", -HS.Node.PCon(""), "The Con function is used to write a reversing entry to the
Elimination member
The elimination amount is written to the Elimination member of the plug account.
Oct 4, 2016
HFM
Consolidation Procedure
Steps
Specific Consolidation rules can also be written in the Consolidate Sub routine
93
Oct 4, 2016
HFM
Consolidation Procedure
Elimination Function - CanEliminate
Function CanEliminate(vPlug, strICP)
vPar=HS.Parent.Member // stores the parent entity of the current member
CanEliminate = TRUE // Initial value set to true
If vPlug="" Then
CanEliminate=FALSE // If there is no plug defined, then set to False
ElseIf strICP="[ICP None]" Then // Checks for Intercompany partner
CanEliminate=FALSE // if ICP Partner is [ICPNone], then set to false
ElseIf Not HS.Entity.IsDescendant(vPar, strICP) Then // Checks if strICP is descendent
of the vPar
CanEliminate=FALSE // if not a descendant, then Set to False
End If
End Function
94
Oct 4, 2016
HFM
Conclusion
95
Oct 4, 2016
HFM
Rule
96
Oct 4, 2016
HFM
Thank You