Core Data Services (CDS) is a collection of specific languages created by SAP. Technically an extension of SQL, it inherits a language for data definition (create, define ...), data manipulation (select, insert, ...) and authorization control (grant, ...)

The objective of Core Data Services is to be able to define a virtual modelling of the data directly in the ERP through what is called the VDM (Virtual Data Model). The aim is to build a semantic layer above the physical database tables.

This new layer will centralise much of the logic and development effort of the business concepts and make them reusable and extensible for developers.

Figure 1: Place of VDM in ERP. SOURCE: S4H410_05 SAP S/4HANA Embedded Analytics and Modeling with Core Data Services (CDS) Views

 

This VDM can be achieved in several places. In his blog, Horst Keller uses the term "One concept, two flavors". This duality represents the use of Core Data Services directly in the HANA database versus its use in the ABAP application layer. Why do we have to do it in two places you might ask:

HANA CDS CDS views are created in the HANA database and can be accessed from the application server using Native SQL. This mode of operation has many similarities with Hana information views.

ABAP CDS The CDS views are created in the application server and enrich the ABAP data dictionary. This mode of operation has many advantages, in particular being linked to ABAP transport orders as well as being able to use ABAP authorisation objects. In addition, the Core Data Services view is part of the DDIC (data dictionary) and can be accessed via Open SQL (much easier to write and read) from any ABAP program.

In my opinion, in the case of a HANA + SAP Netweaver >= 7.4 SP5 architecture, it is better to use ABAP CDS views which benefit from a much better integration and which will facilitate their reuse and deployment.

However, HANA CDS views have the advantage of supporting a larger catalogue of SQL functions. Since ABAP CDS has to be able to be used on multiple different databases, not all of which support the same statements, its range of functions had to be restricted.

In both cases, development is done through Eclipse (and the Abap Developpement Tools plugin forABAP CDS) and is very similar between the two versions.

 

The Virtual Data Model

Whether in Hana CDS or ABAP CDS, the VDM is built around three types of views:

  • Basic views

The Basic view is used to bring back data from the physical tables of the DB. Depending on their "annotations", they may correspond to dimensions (master data), texts or hierarchies. These views cannot be queried and must be used in a composite view. It should be noted that only the "interface views" can be used as an extractor ("datasource") for BW.

  • Composite views

The "composite" view is generally used as a multidimensional model and is responsible for linking the "basic views" together via associations (used in the same way as an SQL join). They are used as the source of the "consumption" views

 

  • Views Consumption

The "consumption" view allows you to create a specific query from a composite view. Note that only the consumption view can be exposed in an OData service for consumption by compatible analytical clients.

Figure 2: Structure of the Virtual Data Model SOURCE: S4H410_05 SAP S/4HANA Embedded Analytics and Modeling with Core Data Services (CDS) Views

 

Annotations

Annotations are used to add Meta data to Core Data Services views. They can be evaluated when the object is activated or when it is consumed by another framework. There are many of them, and it is these annotations that allow, among other things:

  • Name the SQL view generated in the database
  • Categorise a Core Data Services view as basic, composite or consumption
  • To specify whether access control applies
  • Bringing all kinds of semantics to each field of the view
  • Passing input parameters to the view

Each annotation starts with an '@' and only the annotation "@AbapCatalog.sqlViewName: ''" which allows to name the SQL view is mandatory. Beware, with a few exceptions, no control is performed on it, an annotation that cannot be evaluated by a Framework will be ignored.

Below is a link to the SAP standard annotations:https://help.sap.com/doc/abapdocu_750_index_htm/7.50/en-US/abencds_annotations.htm

 

Multi-use of Core Data Services views

Modelling from CDS views is on the SAP roadmap and the publisher intends to place it at the heart of real-time analytics.

Figure 3: CDS views at the centre of the S/4 analytical world. SOURCE: https://blogs.sap.com/2018/08/08/bw-query-on-cds-view-odata-from-bw-and-value-of-bw-query-in-s4hana/

The above diagram only illustrates the use of CDS views, the classical possible links between BW and reporting tools are not shown.

 

Transients Providers

Each "Composite" view generates a "transient provider" (BW) and each "Consumption" view can generate a "transient query" (BW). These BW transient objects allow the CDS views to be perfectly integrated with existing rendering tools which were based largely on the BW queries of the BEX Query designer (BW Modeling tools since 7.5).

Thus, for a "Consumption" view called 'ABC' and having the annotation "@Analytics.query : true" a transient query '2CABC' is automatically generated and usable by all the restitution tools accepting BW queries in source.

Similarly, the "composite" view generates a transient infoprovider '2C+view_name' that can be used by the BW modeling tools

 

In conclusion

In summary, Core Data Services, and particularlyABAP CDS, opens the doors to a new modelling method that is perfectly suited to the design of real-time operational reporting (among other things).

The Virtual Data Model enables the flow to be structured and the data to be enriched semantically to give it more meaning when it is consumed. By integrating the Core Data Services with BW requests and OData services, SAP is therefore consistent with its roadmap and allows its use in most of its restitution tools.

One point that remains to be clarified is the place that HANA CDS will take in relation to information views, with which they share many similarities.

For more information (articles in English) :

https://itpsap.com/dont-try-coding-abap-core-data-services-without-reading-this-first-2/

https://blogs.sap.com/2016/03/10/sap-s4hana-embedded-analytics-a-detailed-walkthrough-part-13/

https://blogs.sap.com/2018/08/08/bw-query-on-cds-view-odata-from-bw-and-value-of-bw-query-in-s4hana/

The following two tabs change content below.

Guillaume Régnier

Guillaume is an experienced consultant. He holds a Master 2 degree in computer science and has been working on SAP Business Intelligence projects since 2014. He implements BI solutions for our clients from specification to production on a wide range of functional components.

Latest articles by Guillaume Régnier (view all)

Share This