SAP CDS ELEMENT ANNOTATIONS V1



Get Example source ABAP code based on a different SAP table
  


• /at ABAP_CDS_ELEM_ANNOT_V1
• /at< ABAP_CDS_ELEM_ANNOT_V1

ABAP_CDS_DDL - DDIC-Based View, SELECT, element_annot

ABAP_SYNTAX
... @annotation ...
... @ < annotation ...

What does it do?
Specifies an annotation annotation in the definition of an element of a SELECT list in a ABAP_CDS_V1_VIEW as element annotation. Element annotations can be specified before and after the element.
In front of the element, the character @ must be placed before the name annotation of the annotation.
Following the element, the characters @ < must be placed before the name annotation of the annotation.
The elements of CDS entities can be annotated with the element annotations listed in topic element_annot.

ABAP_EXAMPLE_VX5
In the CDS view demo_corporation_sales_order, a short text and a tooltip are assigned to the element role. The element currency_code is flagged as a currency key and is assigned as a currency key to the element gross_amount.
DDLS DEMO_CORPORATION_SALES_ORDER
ABAP_EXAMPLE_END
VX_EXA_ONLY

ABAP_EXAMPLE_VX
This example demonstrates inheritance of the element annotations in publications of CDS associations. The following CDS view defines and exposes a CDS association _some_assoc:
DDLS DEMO_CDS_ASSOC_ANNO2
A further CDS view accesses the view and also exposes the CDS association. Here, the annotation @SomeAnno is inherited.
DDLS DEMO_CDS_ASSOC_ANNO1_INH
The following CDS view entity defines and exposes its own CDS association _some_assoc. In this case, the CDS annotation @SomeAnno is not inherited.
DDLS DEMO_CDS_ASSOC_ANNO1_LOC
If the CDS association _some_assoc were exposed from Demo_Cds_Assoc_Anno2 instead of or in addition to _some_assoc by specifying the name Demo_Cds_Assoc_Anno2._some_assoc explicitly, the annotation would be inherited again. The class CL_DEMO_CDS_ASSOC_ANNO evaluates the annotations of both views. No local element annotations are defined for the locally defined association _some_assoc of the view Demo_Cds_Assoc_Anno1_Loc, which means that the result for this CDS association is empty.
ABAP_EXAMPLE_END