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 ABSTRACT ENTITY →  ABAP CDS - DEFINE ABSTRACT ENTITY, element_list →  ABAP CDS - DEFINE ABSTRACT ENTITY, element 

ABAP CDS - DEFINE ABSTRACT ENTITY, element_annot

Other versions: 7.31 | 7.40 | 7.54

Syntax

... @annotation ...

Effect

Specifies an annotation annotation in the definition of an element or CDS association of an abstract CDS entity as element notation. The character @ must be placed directly in front of the name annotation of the annotation. In an abstract CDS entity, element annotations can only be specified in front of an element or a CDS association and not specified after it using @<.

The elements and CDS associations of CDS entities can be assigned to the element annotations grouped under element_annot.


Example

The following DDL source code shows an abstract CDS entity with element annotations:

@Metadata.allowExtensions : true

define abstract entity demo_cds_abstract_entity_elem
  {
        @EndUserText.label: 'Key field'
    key col1 : abap.char(3);
        @EndUserText.label: 'Integer field'
        col2 : abap.int4;
        @EndUserText.label: 'String field'
        col3 : abap.string;
        @EndUserText.label: 'Data element field'
        col4 : demo_char_text;
  }

The program DEMO_CDS_ABSTRACT_ENTITY_ELEM shows that the element annotations of the abstract CDS entity can be evaluated using the class CL_DD_DDL_ANNOTATION_SERVICE. In this case, there are also derived annotations for the data element used for typing and annotations from a CDS metadata extension. The metadata extension is specified as an example for ANNOTATE ENTITY.