Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Annotations →  ABAP CDS - Definition of Annotations →  ABAP CDS - DDL for Annotation Definitions →  ABAP CDS - DEFINE ANNOTATION 

ABAP CDS - DEFINE ANNOTATION, arrelem

Other versions: 7.31 | 7.40 | 7.54

Syntax


... {type;}|{
{subannos}[;]} 

Effect

Defines the elements of an annotation array. If specified after a colon of a main annotation or subannotation defined using define annotation, array of turns the annotation specified in front of the colon into an array of the elements specified after array of:

  • The addition enum can be used
  • The addition default cannot be used
  • The type specification must be closed using a semicolon (;).
  • {subannos} defines an annotation array for subannotations in curly brackets. If specified, subannotations can be closed using an optional semicolon (;).

The same information can be specified for type and subannos as for elementary annotations. It is not possible to define a further annotation array directly. Subannotations can, however, be arrays themselves.


Note

When an annotation array is used in annotation syntax in CDS source code, a comma-separated list is specified in square brackets. This list contains the information defined dictated by type or structure as often as necessary.


Example

Defines an annotation array DemoAnnoIntegerArray for number values.

@Scope:[#VIEW, #EXTEND_VIEW]  
annotation DemoAnnoIntegerArray : array of Integer;

The annotation can be used as follows in CDS source code, for example, to specify as many numbers as necessary:

@DemoAnnoIntegerArray:[123,456,789]


Example

Defines a structured annotation array DemoAnnoStructArray.

@Scope:[#VIEW, #EXTEND_VIEW]  
annotation DemoAnnoStructArray : array of  
             { subAnno1: Boolean default true;  
               subAnno2: String(100) default 'whatsoever'; };

The annotation can be used as follows in CDS source code, for example, to specify as many subannotations as necessary:

@DemoAnnoStructArray:[{subAnno1,      subAnno2},
                      {subAnno1:true, subAnno2:'Some Text'},
                      {subAnno1:true, subAnno2:'Other Text'} ]