How to reuse a BW hierarchy in Calculation views and expose it to reporting ?
Maybe you have tried in the past to advantage of BW hierarchies using HANA calculation views in vain ?
As a consultant I don’t have always le choice of having a BW query at the top level of my data model and after the advent of the BW/4HANA version which opens the door to more than one development scenario, sometimes we’re facing the case where we have a HANA calculation view as the final infoprovider of the data model.
Obviously when we talk about reporting in SAP, we about hierarchies and more particularly when it comes to finance or controlling.
Let’s take as an example 0ACCOUNT as a reference Infoobject and the use of a P&L hierarchy.
The first step would be to load the hierarchy from the source system (ECC or S/4) by implementing a master data data flow for 0ACCOUNT of type Hierarchy:
Check HANA External Views for Master Data and Reporting:
Check the correct generation of the ACCOUNT_HIERARCHY view under: System-local > bw2hana > 0 > Calculation Views
- In the generated ACCOUNT_HIERARCHY view, there is an Input Parameter allowing you to choose the hierarchy to display in a drop-down list, except that this list contains the technical IDs of hierarchies not their
To display the labels it would be necessary to modify ACCOUNT_HIERARCHY, my advice is not to directly modify the generated view but to copy it and modify the copy:
In short, add a join on the HIEID_F4 view (which is also a generated view) and select the HIENM field. Then modify the Input Parameter to point to HIENM instead of HIEID.
Finally modify the filter at the bottom of the data model to filter HIENM
Create a calculation view with star join:
Add the hierarchy view created in step 4 in the star join:
Drag and drop the input parameter from the view from step 4 added in the star join to the target.
This operation is done in the Semantics > Parameters/Variables menu.
Create a calculated column in which we put “_HIERARCHY_PARENT”.
Create a Parent-Child Hierarchy type hierarchy in the Semantics > Hierarchies menu.
The child being 0ACCOUNT and the Parent being the column calculated in step 8.
Launch the view in AFO or another reporting tool and choose the name of the hierarchy.
`Drag/Drop the ACCOUNT object carrying the hierarchy and choose to display as a hierarchy:
The result is as follows:
Managing Director Luxembourg