Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Data Definitions →  ABAP CDS - DDL for Data Definitions →  ABAP CDS - DEFINE HIERARCHY 

ABAP CDS - Hierarchy Attributes

A hierarchy attribute contains hierarchy-specific information about a row in a tabular results set of a database hierarchy function. The following table shows the name and meaning of the potential hierarchy attributes.

Name Data Type Meaning
HIERARCHY_RANK INT8 Sequential number granted as a unique hierarchy node ID when a hierarchy is created.
HIERARCHY_TREE_SIZE INT8 Number of descendant nodes of the hierarchy node (including the hierarchy node itself).
HIERARCHY_PARENT_RANK INT8 0 for root nodes, else the HIERARCHY_RANK ID of theparent node.
HIERARCHY_LEVEL INT4 Hierarchy level of the hierarchy node. Always 1 forroot nodes. For theirdescendant nodes, the distance from the root node plus one.
HIERARCHY_IS_CYCLE INT1 Flag indicating whether the hierarchy node is part of (1) or is not part of (0) a node cycle.
HIERARCHY_IS_ORPHAN INT1 Flag indicating whether the hierarchy node is (1) or is not (0) an orphan node.
NODE_ID SSTRING, length 1333 Internal character-like key of the hierarchy node that chains the values of all target data source fields of the associatedhierarchy associationspecified in the ON conditions. If there is only one comparison in theON condition, no chaining is required and the data type is the data type of the specified field of the target data source.
PARENT_ID SSTRING, length 1333 Internal character-like key of the hierarchy node that chains the values of all source data source fields of the associatedhierarchy associationspecified in the ON conditions. If there is only one comparison in theON condition, no chaining is required and the data type is the data type of the specified field of the source data source.
VALID_FROM, VALID_UNTIL
DATS, TIMESTAMP, TIMESTAMPL This attribute exists only for temporal hierarchies. The contain the limits of thevalidity interval of the currenthierarchy node of atemporal hierarchy.

In the definition of a CDS hierarchy using DEFINE HIERARCHY, the hierarchy attributes can be included in the element list by specifying their names explicitly after a prefix $node.. This makes them components of the structured type represented by the CDS hierarchy with respect to ABAP.

Other versions: 7.31 | 7.40 | 7.54


Note

In ABAP SQL, the hierarchy attributes occur as additional hierarchy columns in the results set of a hierarchy access. More specifically, this is also the case when a CDS hierarchy is accessed. In ABAP SQL this means that there are two different ways of accessing a hierarchy attribute specified in the element list of a CDS hierarchy. See the example program DEMO_HIERARCHY_TREE_HIER_ATTR.