Core Data Service (CDS) – Introduction to ABAP CDS
SAP has new functionality in the technical space – Core Data Services or CDS views. This functionality enables the SAP custom or ABAP report to be more efficient to run. SAP Core Data Services (CDS) also reduces custom report cost, so custom ABAP reports will cost businesses less and CDS can be consumed via the standard GUI and/or Fiori.
In short: use of CDS eliminates the requirement for hundreds or thousands of lines of code.
There are two types of CDS views – ABAP CDS, and HANA CDS. In this article, I am going to provide the basics of what ABAP CDS are and list some of its powerful features.
In Short – CDS is like SAP Views that we all are used to in ECC, but with more capabilities.
Unlike Views that is developed in SE11, CDS is developed using the Eclipse ADT tool. However, you can view CDS in SD11 as well.
You can join several tables, views, other CDS, etc. (Pointer#3 in Figure 1).
Not just inner join; it allows outer join.
It allows left outer join of one or more table – Not possible in older ABAP versions.
Inbuilt SQL and Conversion functions on fields – For example, if you wanted output on a single currency, conversion can be applied on the field using a built-in function. Similarly, date conversions and other SQL functions can be applied to the field.
Union – Not possible until now in ABAP. Generating set from a different source into one table
Allows dynamic generation of fields based on other fields. In figure 1, pointer#5 – you will see “InquiryValidFrom” is generated based on the doc. Category (VBTYP).
Annotations – Annotations are provided at various levels that help the faster deployment of UI code
Code to Data – As the code is pushed to database layer performance is faster and it fetches exactly what is required.
Access control – This powerful feature, associates a view to Access control object (authorization code goes in this object) whereby data from the database is fetched for what you are authorized. No More. No Less. Eg. If you are authorized for sales org 1000, automatically data from Sales org 1000 only be fetched from the database.
These powerful features help developers to build concise code. Without these CDS, developers bring in data and process linearly using the internal table. This logic runs into several hundred lines or even to several thousand lines of code. With CDS – model logic can be cut down to one select statement.
Figure 1 – Sample CDS in created eclipse in our SAP S/4 system at NB Consulting:
Pointer#1 – – Is the View name. This is the name you will use in SE11 or SE16N
Pointer#2 – Short Description of the table
Pointer#3 – Definition where join detail goes in. Definition name is used for the creation of object at the database level and we don’t have to worry about it
Pointer #4 – English name of the field that’s created as the view field
Pointer# 5 – Field value can be dynamically generated based on other fields
Based on the feedback form this article, I will go in depth on some of the features with example.
Related article: Staffing Industry Configurable Product