SAP CDS F1 CUSTOM ELEMENT



Get Example source ABAP code based on a different SAP table
  


• KEY ABAP_CDS_DEFINE_CUSTOM

ABAP_CDS_DDL - DEFINE CUSTOM ENTITY, element

ABAP_SYNTAX
... $[@element_annot1$]
$[@element_annot2$]
...
${ $[KEY$] name : typing $}
$| ${ _assoc : association $}
$| ${ _compos : composition $}
$| ${ _to_parent : to_parent_assoc $} ...

ABAP Addition
1 ... @element_annot
2 ... KEY

What does it do?
Specifies an element name or exposes a CDS association _assoc , a CDS composition _compos, or a CDS-to-parent association _to_parent in the element list of a CDS custom entity. At least one element must be defined as a key element.
The element names name, _assoc, _compos, and _to_parent must specify a unique name that complies with the naming rules for names. It is recommended that the name of a CDS association, a CDS composition, or a CDS-to-parent association starts with an underscore _. The names of the elements are in the same namespace as the parameters of the custom entity. 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 DDIC database table TRESE.
An element name can optionally be defined as key element using the keyword KEY and it must be typed with an elementary data type typing. The typing determines the data type of the corresponding component of the structured data type represented by the CDS custom entity.
The addition association is used to expose a CDS association of the name _assoc.
The addition composition is used to expose a CDS composition with the name _compos.
The addition to_parent_assoc is used to expose a CDS to-parent association with the name _to_parent. No component with the name _assoc , _compos , and _to_parent is created in the associated structured data type. Element names are not case-sensitive. The blanks in the semicolon-separated list are ignored and can be omitted.

ABAP Addition

What does it do?
Specifies annotations for an element. The annotations can be specified in front of every element using @element_annot. Element annotations can be used to annotate the elements and CDS associations, CDS compositions, and CDS to-parent associations of a CDS custom entity with semantic properties.

ABAP Addition

What does it do?
KEY is used to define the current element as a key element of the current CDS custom entity. Those elements of the element list can be defined as key elements that are placed without gaps at the start of the list. At least the first element must be a key element.