ABAP Keyword Documentation → ABAP - Dictionary → ABAP CDS in ABAP Dictionary → ABAP CDS - Annotations → ABAP CDS - Specifying Annotations → ABAP CDS - Annotation Syntax
ABAP CDS - Annotation Syntax, value
Other versions:
7.31 | 7.40 | 7.54
Syntax
... literal
| #SYMBOL
| true|false
| null
Effect
An annotation value can be specified directly after the colon : of an annotation. The following can be specified for the annotation value:
- Literals
- Enumeration symbols #SYMBOL
- Truth values true and false
- Null value null
null
cannot be specified as an
element of
annotation arrays and can only be specified in the
scope of the element annotations.
Only those annotation values should be specified that are supported by the specified type of the associated annotation definition. Unless a default value is specified, a value should be specified in all cases. Non-specified annotation values are not replaced by the default value when the annotation is saved internally and evaluated.
Notes
- No syntax checks are performed on an annotation value in the DDL for data definitions, except for the formal rules above. The annotation is generally only handled correctly when evaluated or activated or by the framework if the annotation value follows the rule in the annotation definition.
- The framework in question is responsible for applying the correct default value if annotation values are not specified.
- References for reference types are specified as character literals enclosed in quotation marks. A literal of this type should not contain any blanks and must reference an existing object. This is checked, for example, by SADL.
Example
The following annotation definition is applied.
define annotation
DemoAnnoValues {
subAnno1: Boolean;
subAnno2: String(5) enum{FLAG1;FLAG2;FLAG3;};
subAnno3: Integer;
subAnno4: Decimal(31,2);
subAnno5: DecimalFloat;
subAnno6: EntityRef; };
The annotation can then, for example, be specified with the following annotation values:
subAnno2: #FLAG1,
subAnno3: 1234,
subAnno4: 123456.78,
subAnno5: 1234.5678E-4
subAnno6: "DEMO_CDS_SPFLI"}