Hi, in this post I would like to consider a case where you need to use in ABAP CDS Analytical Reporting hierarchies from BW Infoobject master data.
In previous posts I have considered creation of custom hierarchy based tables similar SAP HR and annotations used in query to consume it:
- Hierarchies could be loaded or maintained manually in BW embedded in S/4HANA system.
- Considered approach is particularly relevant in case in S/4HANA there is embedded planning solution and you need to reuse existing hierarchy in analytical reports based on ABAP CDS views.
- Considered example will work correctly in case of simple parent-child hierarchies based on one characteristic, without text nodes or linked nodes.
- Consider infoobject MFICOCP04 “Reporting Section” and existing hierarchy in RSH1 t-code:
2. Create ABAP CDS views Dimension, Text, Hierarchy:
3. Analyse dimension VDM in RSRTS_ODP_DIS t-code and notice that hierarchy metadata is presented here.
4. Test of hierarchy display in RSRT:
5. Use annotations in analytics query to display hierarchy:
Below ABAP CDS view is needed to derive hierarchy name based on reporting year parameter, in example we had several hierarchies maintained for characteristic.
Analytical query code:
Note that derivation of hierarchy guid based on a hierarchy name may be not required in your case, just simplify solution (if needed)
We considered creation of hierarchy ABAP CDS view based on BW Infoobject master data tables.
I would like to thank Former Member for her help with BW part of this example! Thank you!
Thank you for attention!