Ansicht
Dokumentation

ABENCDS_F1_HIERA_ELEMENT - CDS F1 HIERA ELEMENT

ABENCDS_F1_HIERA_ELEMENT - CDS F1 HIERA ELEMENT

CPI1466 during Backup   CPI1466 during Backup  
This documentation is copyright by SAP AG.
SAP E-Book

- DEFINE HIERARCHY, element

... $[@element_annot1$]
    $[@element_annot2$]
    ...
       $[KEY$] ${ _assoc                   $[AS alias$] $}
           $| ${ element                  $[AS alias$] $}
           $| ${ $node.hierarchy_attribute AS alias  $}
    $[@element_annot1$]
    $[@element_annot2$]  ...


Alternatives:

1. ... _assoc

2. ... element

3. ... $node.hierarchy_attribute

Additions

1. ... @element_annot ... @element_annot

2. ... KEY

3. ... AS alias

Effect

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.

Alternative 1

... _assoc


Effect

_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 :

  • A CDS view can evaluate the CDS association in its path expressions (, CDS view entity).

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.

Note

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.

Alternative 2

... element


Effect

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.

Note

When the hierarchy is accessed in , the element is a regular component of the SQL hierarchy in the results list, if * or ...~* are used in the SELECT list.

Alternative 3

... $node.hierarchy_attribute


Effect

$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.

Notes

  • When the hierarchy is defined in , 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 , 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.

Addition 1

... @element_annot

Effect

Specifies annotations for the element. The annotations can be specified before the element using @element_annot or after the element using @element_annot.

Note

Element annotations can be used to annotate the elements and CDS associations of a CDS hierarchy with semantic attributes.

Addition 2

... KEY

Effect

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.

Otherwise, the key elements of the CDS entity are used to document the semantics of the data model. The addition KEY is then ignored when the CDS hierarchy is activated and when other accesses are performed in program executions.

Notes

  • In the syntax check, the key elements are used in places where the key is respected.
  • The key elements are not relevant for the uniqueness of rows within the result set of the CDS hierarchy, which means that exceptions can be raised when making assignments to internal tables with appropriately unique table keys.

Addition 3

... AS alias

Effect

Defines an alternative element name for the current element. The alternative element name replaces the actual name of the element. When the current CDS hierarchy is accessed, the alternative element names must be used instead of the actual name.






SUBST_MERGE_LIST - merge external lists to one complete list with #if... logic for R3up   Addresses (Business Address Services)  
This documentation is copyright by SAP AG.

Length: 12676 Date: 20240328 Time: 221614     sap01-206 ( 167 ms )