ABAP Keyword Documentation → ABAP - Dictionary → ABAP CDS in ABAP Dictionary → ABAP CDS - Data Definitions → ABAP CDS - DDL for Data Definitions → ABAP CDS - DEFINE TABLE FUNCTION → ABAP CDS - DEFINE TABLE FUNCTION, element_list
ABAP CDS - DEFINE TABLE FUNCTION, element
Other versions:
7.31 | 7.40 | 7.54
Syntax
... [@element_annot1]
[@element_annot2]
...
[KEY] name : typing
[@<element_annot1]
[@<element_annot2] ...
Extras
1. ... @element_annot ... @<element_annot
2. ... KEY
Effect
Specifies an element in the list of elements of a CDS table function. name expects a unique element name that complies with the naming rules. The names of the elements are in the same namespace as the parameters of the table function. Furthermore, name cannot contain any slash (/) characters and cannot be a reserved name in ABAP Dictionary. The reserved names that cannot be used are specified in the database table TRESE.
Each element must be typed with an elementary data type
typing. This typing determines the data type of the corresponding component of the structured
data type represented by the CDS table function and the associated column of the tabular return value result
of the associated AMDP function implementation.
It is not case-sensitive. The blanks in the comma-separated list are ignored and can be omitted.
Addition 1
... @element_annot ... @<element_annot
Effect
Specifies annotations for the element. The annotations can be specified before the element using @element_annot or after the element using @<element_annot.
Note
An ABAP annotation can be used to assign further technical and semantic attributes to an element in ABAP Dictionary. Framework-specific annotations can be used to give the element specific semantic attributes for other SAP frameworks.
Addition 2
... KEY
Effect
KEY is used to define the current element as the key element of the current
CDS table function. Elements of the
element list can be defined as key elements, which are coherently grouped at the beginning of the list, whereby the client field of a
client-specific CDS table function is ignored.
The key elements of the CDS entity are evaluated as follows if they are used as a data source of a SELECT
statement in ABAP SQL:
- By the addition
ORDER BY PRIMARY KEY
.
- In implicit access control.
Otherwise, the key elements of the CDS entity are used to document the semantics of the data model. The addition KEY is then ignored when the CDS table function is activated and when other accesses are performed in program executions.
Notes
- In the ABAP SQL syntax check, the key elements are used in places where the key is respected.
- The key elements are not relevant for the uniqueness of rows within the results set of the CDS table function, which means that exceptions can be raised when making assignments to internal tables with appropriately unique table keys.