The CDS entity represents the actual CDS view. It is based on a
CDS database view and makes other attributes possible, such as
access controls
defined in CDS. The name of this entity, cds_entity, is defined in the
definition of a CDS view after
DEFINE VIEW. The definition of the CDS entity occurs only as CDS source code. The ABAP Dictionary tool in ABAP Workbench
(SE11) does not recognize the CDS entity.
As a data type in ABAP Dictionary, the CDS entity represents a structured type with the
elements of the CDS view as components and can be used like any
CDS entity.
In ABAP CDS, the CDS entity can be used as a data source of other CDS entities.
In ABAP, the CDS entity can be used as a data type and in Open SQL read statements.
The CDS entity cannot be used as a data type for definitions of classic dictionary objects in ABAP Dictionary.
The CDS database view is the technical foundation of the CDS view in ABAP Dictionary. It is a read-only classic
database view. The name CDS_DB_VIEW of this view is defined in the
definition of a CDS view in the
CDS annotation@AbapCatalog.sqlViewName. The ABAP Dictionary tool in ABAP Workbench
(SE11) can display a CDS database view, but it cannot be edited here. When the view is activated, the corresponding SQL view is created with the same name.
As a data type in ABAP Dictionary, the CDS database view represents (like all classic database views) a flat
structure with the
elements of the CDS view as components. The CDS database view of a
client-specific CDS view always has a client column, unlike the CDS entity.
In ABAP Dictionary, the CDS database view can be used like any classic
structure, such as the type of a substructure, as an include structure, or as the row type of a table type.
The CDS database view should not, however, be used in ABAP. It can be used wherever database tables
or classic database views can also be specified (using its name CDS_DB_VIEW),
such as after the TYPE addition, in Open SQL read statements and also in
Native SQL or after the TABLES statement (but this is not recommended). More particularly, the use of the CDS database view in reading Open SQL statements is
obsolete and forbidden in
strict mode from Release 7.50. Instead, the CDS entity should be accessed in ABAP, which covers all attributes of the CDS view.
Both the names cds_entity and CDS_DB_VIEW are in the namespace of the
data types in ABAP Dictionary. The view is also known
under both names within the CDS DDL of the ABAP CDS. Furthermore, only the CDS entity should be accessed
in other CDS entities using its name cds_entity and not the CDS database view using the name CDS_DB_VIEW.
A CDS view has two types of keys:
For CDS entities, KEY can be used to define key elements. This key is the semantic key of the CDS view.
The key of the CDS database view is determined implicitly, as in a classic view. This key is the technical key of the CDS view.
In Open SQL, the key used is determined according to whether the name of the CDS entity or the name of the CDS database view is used to access a CDS view.
The following sections describe client handling and SAP buffering for CDS views:
The programming of CDS views using the CDS DDL of the Core Data Services is one of the tasks included
in the implementation of data models in ABAP Dictionary and is not usually the responsibility of regular
ABAP application programmers. Once created, CDS views are used in ABAP programs using Open SQL read statements and must be stable enough to allow this.
As well as the specific functions available for CDS views, such as the definition of associations,
the options for the regular SQL DDL of the CDS DDL are far more comprehensive than the form-based ABAP Dictionary tool in ABAP Workbench used to define
classic views.
CDS views are defined as platform-independent views. They can, however, contain components that are not currently supported by all database systems. Before an ABAP read, the class
CL_ABAP_DBFEATURES can be used to determine whether the feature is supported in the current system, which stops an exception from being raised.
If a CDS role is defined for a CDS entity using the CDS DCL statement DEFINE ROLE and
CDS access control is not disabled using the value
#NOT_ALLOWED for the annotation @AccessControl.authorizationCheck, any reads performed on the CDS entity using Open SQL or using an
SADL query are subject to implicit access control and only that data is read that meets the
access conditions.