SAP CDS ANNOTATIONS - Syntax VALUE



Get Example source ABAP code based on a different SAP table
  


• true ABAP_CDS_ELEMENT
• false ABAP_CDS_ELEMENT
• null ABAP_CDS_ELEMENT

ABAP_CDS_DDL - Annotation Syntax, value

ABAP_SYNTAX
... literal
$| #SYMBOL
$| true$|false
$| null

What does it do?
An annotation value can be specified directly after the colon : of an annotation. The following can be specified for the annotation value:
Literals Character literals enclosed in quotation marks or numeric literals. A numeric literal can have a period (. ) as a decimal separator and can be specified with an exponent in scientific notation.
A single quote can be used to escape another single quote or, alternatively, using a backslash .
Example: @EndUserText.quickInfo: 'Customer''s first name' is resolved into Customer's first name.
Alternative: @EndUserText.quickInfo: 'Customer 's first name' is resolved into Customer's first name.
Enumeration symbols #SYMBOL Enumeration symbols are specified directly after the # character and without quotation marks.
Truth values true and false These values can be enclosed in quotation marks but do not have to be.
Null value null This value can be specified without quotation marks for element annotations. This means that the annotations are ignored in the evaluation by default. The value 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.



Latest 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.
NON_V5_HINTS
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 the RAP framework.
ABAP_HINT_END

ABAP_EXAMPLE_VX5
The following annotation definition is available.
DDLA DEMOANNOVALUES
The annotation can then, for example, be specified with the following annotation values: @DemoAnnoValues: {subAnno1: false,
subAnno2: #FLAG1,
subAnno3: 1234,
subAnno4: 123456.78,
subAnno5: 1234.5678E-4
subAnno6: 'DEMO_CDS_SPFLI'}
ABAP_EXAMPLE_END