SAP CDS ENTITIES



Get Example source ABAP code based on a different SAP table
  



ABAP_CDS - Data Definitions
CDS data definitions are written in the CDS data definition language ( CDS DDL ) of ABAP CDS. CDS data definitions can be used to define the following CDS entities or CDS DDIC-based entities:
CDS view entities
CDS projection views
CDS table functions
CDS hierarchies
CDS custom entities
CDS abstract entities
ABAP_CDS_V1_VIEWS
A CDS entity is a structured object in ABAP CDS. When DDL source code with a CDS data definition is activated, the CDS entity is created in form of a metadata representation in system tables. 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 runtime framework and other frameworks access the internal metadata of CDS entities. For example, the ABAP runtime framework recognizes a CDS entity as a global type or as a potential data source of AB-SQL statements. The name of a CDS must be unique accordingly.
A CDS entity represents the following type properties (or signature) as a global data type:
Metadata defined using CDS annotations
A structured type defined using an element list
Optional parameter interface defined using input parameters
Optional CDS associations exposed in the element list
In ABAP CDS, CDS SQL entities can be used as 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.
BEGIN_SECTION VERSION 5 OUT The properties of the structured type can be evaluated using RTTI.
END_SECTION VERSION 5 OUT CDS SQL entities can be accessed in AB-SQL read statements or AMDP
BEGIN_SECTION VERSION 5 OUT but not in Native SQL.
END_SECTION VERSION 5 OUT
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:
CDS view entities
CDS projection views
CDS table functions
CDS hierarchies
CDS custom entities
CDS abstract entities
CDS DDIC-based entities
A further section describes the problems that can arise due to cyclical dependencies between CDS entities.



Latest notes:

CDS entities are in the namespace of all global types of an AS ABAP.
If a CDS role is defined for a CDS SQL entity using the CDS DCL statement DEFINE ROLE, implicit access control is applied when the CDS entity is accessed in AB_SQL . 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 the FROM clause of an AB-SQL query.
When a CDS entity is used as a data source in another CDS entity, its CDS access control defined in CDS DCL is not considered when the wrapping entity is accessed. CDS access control only applies to the entry level entities accessed by AB_SQL .
Once a piece of DDL source code has been activated, its name or names is/are stable and cannot be modified. The same applies to the DDL source code of a CDS view extension (and, if available, its DDIC append view).
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.
A structure type defined using a CDS entity exists alongside the DDIC structures in ABAP Dictionary.
NON_V5_HINTS
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.
ABAP_HINT_END