This is the second blog of Complex Tree Hierarchical Report via Fiori Elements. In the
First Blog, I discussed theoretical and design aspects for the Tree Report using the Fiori Elements. Here, I would be demonstrating all practical real time development steps.
Business Scenario
Let us consider the
complex Handling Unit Hierarchy in SAP. Typical Business scenario representation for the Handling Unit can be considered as below where handling units are nested inside one each other.
"Business wants a Hierarchical Tree Report to view the hierarchy and information for the given Handling Unit".
Important Consideration For Technical Design : Handling Unit Hierarchy contains Bigger Container which contains lakhs of Handling Unit, so all the Data should not be loaded upfront.

for the above Handling Unit hierarchy can be understood with the below Tree Hierarchy
Technical Design:
I would be covering complete technical design in 4 steps.
- Data Model CDS Design
- Gateway Service Implementation
- UI development via Fiori List Report generation.
- List Report Extension to support Parameter.
Technical Tip
"Needs to take full advantage Fiori Element via SADL Framework so only selected Handling Unit data should be Retrieved" So we will be using the Parametrized CDS and Standard SQL Script functions for complex calculations"
Data Model CDS Design:
for the Demo purpose, I have created Custom Table ZVEKP (copy of VEKP) and manually added entries to make Parent child Relationship.

CDS Data Model Design can be understood via below design
Parametrized Table Function and corresponding AMDP Design
- We have used the Hierarchy Function to retrieve the hierarchy.
- Additional complex logic can be written via SQL Script.
- Table function has parameter for external handling unit which will used to read hierarchy dynamically for the given node

Data Modelling for
Composite and Consumption CDS
- Presentation variant has been added for the Sort Order in Consumption CDS.
- Header Annotation has been Added for the Header of the List Report
- Line-Item Annotation has been added for the UI Line Item.
- Selection field is via Parameter – Mandatory Input Parameter

Gateway Service Modelling
We have used the reference data source for CDS binding to OData Service.

for the List Report based template to support Tree table, it is mandatory to have
Hierarchy annotations should be added in the Meta data, which can be added via
MPC_EXT redefine the define method.

Now, We are all set to do UI Development.
- Select Fiori Element based List Report Template.
- Set the Table Type as TreeTable in manifest.json

We are almost done except proper URL pass to Backend. As we are using the Parametrized CDS.
Parametrized CDS create the Mandatory input field in the App, which can be checked from the Meta data.
so we need to handle it via List Report Extension.

in the List Report Extended Controller ,
Yes. We are all done
🙂 Execute the Report and here we go..
