What does it do? Specifies an element in the element list> of a CDS hierarchy>. The names of the elements in a CDS hierarchy must be unique and must be in the same namespace as the parameters> of the CDS hierarchy.
ABAP Alternative 1 ... _assoc>
What does it do? _assoc> can be used to make the CDS hierarchy expose a CDS association> that itself is exposed by the CDS view cds_view> specified after SOURCE>> in its SELECT> list. The name of a CDS association can be specified for _assoc> but path expressions are not possible. The CDS hierarchy exposes the CDS association for use in CDS views or in AB_SQL :
A CDS view can evaluate the CDS association in its path expressions ( ABAP_CDS_V1_VIEW >, CDS view entity>).
The CDS association can be used in AB_SQL path expressions>. The current CDS hierarchy is the association source> of the exposed CDS association and any join expressions created for a path expression from the CDS association use the current CDS hierarchy as their left side. All fields of the association source> of the CDS association that occur in the ON> condition must also be specified as elements of the current element list. A CDS association exposed in this way is, like any element, part of the element list. It is not, however, part of the result set or a component of a type defined in ABAP with respect to the CDS hierarchy. If no alternative element name alias> is defined, the element name is defined by the name of the CDS association.
Latest notes: When a CDS association is exposed, care should be taken that the exposing hierarchy itself is the association source> of the exposed CDS association and not the data source of the view. More specifically, when CDS associations are exposed that were already exposed by the source of the hierarchy, the hierarchy replaces the original view as the association source> of the CDS association. The left side of an instance of a join expression created for the exposed CDS association is the result set of the hierarchy. NON_V5_HINTS ABAP_HINT_END
ABAP Alternative 2 ... element>
What does it do? element> can be used to specify an element of the CDS view cds_view> specified after SOURCE>>. This element is part of the result set of the CDS hierarchy and a component of a type defined in ABAP with respect to the CDS hierarchy.
Latest notes: When the hierarchy is accessed in AB_SQL >, the element is a regular component of the SQL hierarchy> in the results list, if *> or ...~*> are used in the SELECT> list. NON_V5_HINTS ABAP_HINT_END
ABAP Alternative 3 ... $node.hierarchy_attribute>
What does it do? $node.hierarchy_attribute> can be used to specify a hierarchy attribute> hierarchy_attribute> after the prefix $node>. The names of all hierarchy attributes> can be specified for hierarchy_attribute>. In this case, AS ALIAS> must be used to define an alternative element name, which cannot be the name of a hierarchy attribute. This element is part of the result set of the CDS hierarchy and a component of a type defined in ABAP with respect to the CDS hierarchy. When the CDS hierarchy is accessed, the element contains the respective value of the hierarchy attribute for each row.
Latest notes:
When the hierarchy is defined in AB_SQL >, the element is a regular component of the SQL hierarchy> in the results list, if *> or ...~*> are used in the SELECT> list.
When the hierarchy is accessed in AB_SQL >, the associated additional hierarchy column> can be used to access the hierarchy attribute.
It is practical to include a hierarchy attribute in the element list of a CDS hierarchy explicitly either if it is required when other CDS entities access the CDS hierarchy, or if it is a component of a structured type in ABAP that references the CDS hierarchy. NON_V5_HINTS ABAP_HINT_END
ABAP Addition
What does it do? Specifies annotations for the element. The annotations can be specified before the element using @element_annot>> or after the element using @ < element_annot>>.
Latest notes: Element annotations can be used to annotate the elements and CDS associations of a CDS hierarchy with semantic properties. NON_V5_HINTS ABAP_HINT_END
ABAP Addition
What does it do? KEY> is used to define the current element as a key element of the current CDS hierarchy>. Those elements of the element list> can be defined as key elements that are placed without gaps at the start of the list.