Formula variables of the type 'Replacement Path' can be filled by values derived from the key or attribute key of an InfoObject. There is a comprehensive consulting note which explains all details of this rather complex feature:
There are various ways of defining formula variables(FV), the following two are the most important one:
- FV Replaced by Attribute(FVA)
The formula variable is replaced by the values of an (key figure) attribute of a characteristic (e.g. IO1). In this case the feature 'Exception Aggregation for Formulas' is used and IO1(so called reference characteristic) is added to the drilldown characteristics (non visible drilldown characteristic). This kind of 'calculation before aggregation(only!)regarding IO1!' is done automatically. See also Note 1228378 and Note 1385580. If the variable is used alone in a formula the aggregation MAX is taken. If yo use the Modeling Tools of the Hana Studio to define your queries, it is also possible to change this default behavior by setting the flag 'After Aggregation' for the formula variable. Then, the replacement works as explained in note 1385580 for Hierarchy Attributes. See Example8.
- FV Replaced by Key(FVK)
The formula variable which is replaced by the key of a characteristic (e.g. IO2). In old BW3.x releases this formula variable was replaced before the aggregation (over the corresponding infoobject !) in calculated key figures and it was replaced after the aggregation in formulas. As of BW7x releases, the replacement occurs by default always after the aggregation! Hence, after an upgrade a corresponding calculated key figure may deliver different results(e.g. you get just an 'X' displayed), please see note 1005772 for further details. There a report is given(RSR_VAR_REPPATH_AGGREGATION) which you can use to change the variable back to 'Calculation before Aggregation'. In table RSZGLOBV you can then find the entry 1ATTRKEY in the field ATTRINM - meaning that this variable is technically now treated like a formula variable replaced by an attribute. If yo use the Modeling Tools of the Hana Studio to define your queries, it is also possible to change this default behavior by removing the flag 'After Aggregation' for the formula variable. Then, the replacement works basically the same way as for variables of type FVA(see Example9).
In the variable definition dialog you can choose between 'from','to' and 'interval' value - these settings are only taken into account if there is a filter with well defined interval. If e.g. the InfoObject IO2 isn't restricted at all, you only get 'X' displayed for the result lines (where the system had to aggregate over IO2). See also note 1385580.
The following selections exist:
(SA) from infoobject which is drilled down
(SC) from cell editor
(S1) from structure 1
(SF) from global&hard filter
(SD) soft filter (default values)
Roughly (see note 1385580 for details) the selections are checked in the order given above.
In the following you can find simple examples to this topic which should help to better understand how formula variables work.
FVK - Replaced by Key
- Example1 - simple example with 'isolated' formula variable
- Example2 - simple formula with formula variable
- Example3 - query with two structures
- Example4 - query issues the error message BRAIN_DEV001
FVA - Replaced by Attribut Value
- Example5 - simple example
- Example6 - simple example with 'isolated' formula variable
- Example7 - simple example of key figure attribute aggregation
FVA: Example where the flag 'After Aggregation' is once switched on and once switched off: Example8
Other Types of Formula Variables
Formula Variables behave like Constants
Formulas with Constants (check e.f. when facing performance issues)
SAP Consulting Notes
- 1385580 - How does a formula variable with a replacement path work?
- 1843021 - Adaption for replacement variables after aggregation
- 1005772 - Formula variables with replacement from key
- 1863175 - Formula Variables
- 379832 - Calculating w/ variables w/ subst. from attrib. w/o char
- 2198257 - Formula using only Formula Variable Replaced by Key Figure Attribute has Different Results after Upgrade to 7.3x above