ABAP Keyword Documentation → ABAP - Dictionary → ABAP CDS in ABAP Dictionary
ABAP CDS - Data Definitions
CDS data definitions are created using the CDS DDL of the ABAP CDS in the DDL source code. CDS data definitions can be used to define (and possibly enhance) the following CDS entities:
A CDS entity is a structured ABAP CDS object managed by ABAP Dictionary. When a CDS data definition is activated, it is created as metadata in DDL source code. The CDS entities themselves are not transported. Instead they are created after the transport of a DDL source code when this code is activated in the target system. Each CDS entity is defined in a separate piece of DDL source code in the ABAP Development Tools (ADT). In the development tools, CDS entities are only visible as CDS definitions in their DDL source code. The ABAP Dictionary tool in ABAP Workbench (SE11) does not support any CDS data definitions of CDS entities. The ABAP runtime environment and other frameworks access the internal metadata of CDS entities. For example, the ABAP runtime environment recognizes a CDS entity as a data type of ABAP Dictionary or as a potential data source of ABAP SQL statements. The name of a CDS must be unique accordingly.
As a data type in ABAP Dictionary, a CDS entity represents the following type attributes (or signatures):
- Metadata defined using CDS annotations
- A structured type defined using an element list
- A parameter interface defined using input parameters (if applicable)
- CDS associations published in the element list (if applicable)
In ABAP CDS, a non-abstract CDS entity can be used as a data source in other CDS entities. In ABAP,
a CDS entity can be specified after the TYPE
addition to reference its structure
type and its components in ABAP programs. The components of the structured type are, as usual, specified
using the structure component selector cds_entity-comp
. The attributes of the structured type can be evaluated using
RTTI. Non-abstract CDS entities can be accessed in ABAP SQL read statements or AMDP but not in Native SQL .
A CDS entity cannot be used as a data type in ABAP Dictionary. It cannot, for example, be used as a type of a substructure, as an include structure, or as the row type of a table type.
The following sections describe the possible CDS entities and the associated DDL statements:
A further section describes the problems that can arise due to cyclical dependencies between CDS entities.
Other versions:
7.31 | 7.40 | 7.54
Notes
- CDS entities are in the namespace of the global data types in ABAP Dictionary and of the global object types in the class library.
- The DDL source code of a data definition for a CDS view does not need to have the same name as the entity, but this is recommended. The data definition for an abstract CDS entity must have the same name as the entity itself.
- If a CDS role is defined for a non-abstract CDS entity (CDS view, CDS table function, or CDS hierarchy)
using the CDS DCL statement DEFINE
ROLE, implicit access control is applied in ABAP SQL accesses performed on the CDS entity and only that data can be accessed that meets the
access conditions.
Access control can be switched off using the value #NOT_ALLOWED for the annotation @AccessControl.authorizationCheck and using the addition
WITH PRIVILEGED ACCESS
in theFROM
clause of an ABAP SQL query
- In activations, the names of a piece of DDL source code, the CDS entity, and (if necessary) the CDS database view construct an indivisible defining unit. After a piece of DDL source code is transported for the first time, this defining unit cannot be used elsewhere and none of the names used can be modified. More specifically, the following applies:
- In a piece of DDL source code, the name of a CDS entity or a CDS database view cannot be renamed.
- A CDS entity or CDS database view cannot be used in a different piece of DDL source code, if the original source code was deleted.
- A piece of DDL source code already used for a CDS entity or CDS database view cannot be used for a different CDS entity or CDS database view.
- A CDS view cannot be transformed to a CDS table function (and back).
- The DDL source code of a data definition for a CDS entity is edited in a different editor than the DDLA source code of a CDS annotation definition, the DDLX source code of a CDS metadata extension, and the DCL source code of a CDS role for CDS access control. The ADT documentation describes how the different types of source code are created. DDL source code can also be displayed in Repository Browser in ABAP Workbench.
- The program DEMO_SHOW_DDL_SOURCE displays DDL source code for CDS entities in SAP GUI.
- A structure type defined using a CDS entity exists alongside the classic structures in ABAP Dictionary.