ABAP Core Data Services (ABAP CDS)
Play the video to learn about ABAP Core Data Services (ABAP CDS).
Let us have a closer look at these tasks.
For a long time, ABAP developers defined views in the ABAP dictionary, in the same way they define database tables. These dictionary views were very limited in terms of SQL logic. They only supported inner joins, a field selection (projection) and simple filter conditions. Note, that the definition of dictionary views is not supported in cloud based ABAP environments.
One of the reasons why SAP introduced Core Data Services in ABAP was the demand for the execution of logic on the database. As you will learn later in this training, ABAP CDS views support a large variety of SQL expressions and functions to push down logic onto the database.
There are two types of CDS views.
- CDS DDIC-based views (obsolete)
This obsolete type of CDS views uses a generated dictionary view as technical representation for the database object. CDS DDIC-based views are defined with the DEFINE VIEW statement.
- CDS View Entities
This new generation of CDS views is defined with the DEFINE VIEW ENTITY statement. CDS view entities define the database object directly, without generating a dictionary object, first.
In this training, we will only cover CDS view entities. For the older view types, refer to the ABAP keyword documentation.
ABAP CDS not only supports the technical definition of database objects. It also allows you to enrich the technical definitions with semantic information.
Let us have a look at an example.
CDS view entity Z00_C_Employee is defined with a
define view entitystatement in a CDS data definition. This is the technical definition of the view, and it is used to create a view named Z00_C_EMPLOYEE on the database. In addition to the
define view entity statement, the source code contains annotations. Annotations are code elements that enrich the technical view definition with semantic information. Annotations start with an at-sign (@).
Only a few annotations are evaluated by the ABAP system. The rest is simply passed on to the consumers of the CDS entity, that is, the frameworks that use the CDS entity to read data. The consumers decide by their own which annotations they evaluate and which they ignore.
The most important consumers of ABAP CDS entities are modern UI technologies like SAP Fiori and SAP S/4HANA embedded analytics.
The heart of the ABAP RESTful Application Programming Model is the Business Object.
The structure of the Business Object is modeled with one or more CDS view entities. A CDS behavior definition is used to add the transactional logic. The transactional logic is implemented in an ABAP behavior pool, an ABAP class in the ABAP source code library.
Business Objects are often consumed by Business Services, for example OData services. But you can also access them in ABAP code, using the Entity Manipulation Language (EML).
The details of modeling, implementing and using Business Objects are not part of this training. They are discussed in a dedicated course on the ABAP RESTful Application Programming Model.