SAP HIER DESC AGG ABEXA



Get Example source ABAP code based on a different SAP table
  



SELECT, Hierarchy Navigator HIERARCHY_DESCENDANTS_AGGREGATE
This example demonstrates the hierarchy navigator HIERARCHY_DESCENDANTS_AGGREGATE with the addition JOIN.

ABAP_SOURCE_CODE
DEMO CL_DEMO_HRRCHY_DESCENDANTS_AGG

ABAP_DESCRIPTION
Calls of the hierarchy navigator HIERARCHY_DESCENDANTS_AGGREGATE where the CDS hierarchy DEMO_CDS_PARENT_CHILD specified as a source is joined with a DDIC database table DEMO_CHILD_NUM and an internal table @itab using the addition JOIN . The aggregate functions evaluate the column NUM of the joined data sources. The results of the join expressions used are also displayed.
In the first part, the table DEMO_CHILD_NUM is filled to produce a 1:1 relationship between the rows of the hierarchy and its own rows. The result of the hierarchy navigator is the same as in the executable example CL_DEMO_HIERARCHY_AGGREGATE , but here the number values are taken from the joined table.
In the second part, the internal table @itab contains the rows of the DDIC database table DEMO_CHILD_NUM and further rows that also match the criteria for descendant nodes for nodes of the hierarchy. This example shows how these additional rows, produced in the result set of the join, are evaluated in the aggregate functions.
The statement ASSERT shows that the use of the hierarchy generator HIERARCHY and a semantically identical CDS hierarchy as the source of the hierarchy navigator produces the same results.