Skip to content

ABAP Keyword Documentation →  ABAP - Dictionary →  ABAP CDS in ABAP Dictionary →  ABAP CDS - Data Definitions 

ABAP CDS - Views

A CDS view is defined for existing database tables and any other views or CDS views in ABAP Dictionary using the statement DEFINE VIEW in the CDS DDL in ABAP Core Data Services (CDS). This is done in the DDL source code of a CDS data definition in the ABAP Development Tools (ADT). DCL source code in a CDS view can also be displayed in Repository Browser in ABAP Workbench. When the CDS data definition of a CDS view is activated, two ABAP Dictionary objects area created:

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 DDL 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 ABAP SQL read statements.
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 ABAP SQL read statements and also in Native SQL, AMDP, or after the TABLES statement (but this is not recommended). More particularly, the use of the CDS database view in ABAP SQL read 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 names, cds_entity and CDS_DB_VIEW, are in the namespace of the data types in ABAP Dictionary and of the global object types in the class library. 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 database view. This key is the technical key of the CDS view.

In ABAP 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 table buffering for CDS views:

Other versions: 7.31 | 7.40 | 7.54


Notes

  • The programming of CDS views using the 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 ABAP 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 CDS 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.

  • For CDS views, CDS view enhancements are a separate way of making enhancements without making modifications.

Continue

ABAP CDS - Client Handling in CDS Views

ABAP CDS - Table Buffering of CDS Views