Posted on

CDS Views in 21 Points

CDS views

 CDS Views

  • Views are Projection over Data and are not Actual Data. Similarly, CDS(Core Data Services) are views which are projection over Database Tables.
  • With CDS View one can create a view by writing DDL Code which is easier to understand.
  • CDS Views can have a relationship with each other like association, composition, and also Join like Left outer Join, Inner Join, etc. Using this you can create complex data models.
  • In S/4 HANA® VDM is created with CDS Views. And it is one of the key selling points of S/4 HANA®.
  • VDM stands for Virtual Data Model, the concept is you do not expose a database directly to the outside world but you create views over the database and with the help of these views one can read data and update data.
  • Views are primarily used to read data and with the help of ABAP® code, you can update the data which is mostly in the case of Transactional Application.
  • The Update of data in Transactional Application in S/4 HANA® is done with AMDP, BOPF, ABAP® Restful Programming, etc.

If you want to see and learn CDS-Based Development Hands-on. You can also check out the CDS Professional Development course here. We have also other courses like ABAP® Restful here where we have covered the VDM in-depth and how one can create a transactional application with the Restful framework.

 

Advantage of CDS Views 

  • The main advantage of CDS views is with the CDS view you can create full-fledged Data Models.
  •  For example, imagine you have to create a data model for the Order to Cash process. Here let’s only consider Sales Order Part for now. In this case, you will have a Header and Item tables. Now in data modeling, you will be creating CDS view for Header Table and CDS view for the Item table. Then you will specify that they have a composition or association relationship. The CDS view which directly extracting data from the Database table is called Basic CDS View. These Basic CDS Views can remain the same for all the Projects. Developers can further extend the Basic CDS Views to create Composite CDS Views. This layer of CDS Views can be used in applications. One can again Create one more layer of CDS Views over Composite CDS Views called Consumption CDS view which will be Custom Build to be used in a specific application. The naming convention of the Basic CDS view is (I_*, example I_PurchaseDocHeader), composite is (I_*) and consumption is (C_*). These Hierarchies are referred to as VDM(Virtual Data Model) which is one of the key aspects of S/4 HANA®.
  • CDS Views are not dependent upon the database, so you can use CDS views over any SAP® Supported Database.
  • In CDS Views Client Handling is automatic, even if you want to ignore it in your code, it can be handled internally.
  • In CDS one can use Aggregation and Numeric Function.
  • In CDS View you can have a calculation field that can automatically calculate values-based upon every time an update of the value happens. This field can use Aggregation and Numeric Function as well. For example, if you want to Aggregate all the Item Price in Sales Order Header. This can be done with Aggregate functions. You can have a custom field in your Header CDS views with Aggregate functions to achieve this.
  • CDS views can be used in ABAP® Code to read data.
  • You can have complex Joins and Projection over the database with CDS View using CDS DDL Code.
  • CDS Views supports Open SQL Syntax. So, you can call CDS View with Open SQL in ABAP® Code.
  • CDS Views can also be viewed with SE11 T-Code Using CDS View’s SQL View Name. 
  • CDS Views are Part of the ABAP® Data Dictionary.
  • CDS View can be easily exposed as oData Service by Just adding a single annotation as @odata.publish: true
  • And finally, the most exciting thing you can do is add semantic information to data, with information like how should the data appear in UI, what the data holds, is it a currency or timestamp, what should it be called in the UI layer, what is the sequence in which data need to be represented in UI, etc.
  • This semantic information is called Annotation. Annotations can be of different types and start with a @ symbol. With the CDS Views, one can also define the UI and Presentational aspects within the view. By adding the annotation to CDS View one can control how the data is represented in frontend logic irrespective of which application is using it.

To Learn CDS Development Professionally You can Enroll in our In-Depth CDS Professional Development Course here.

UI5CN CDS Course
CDS Course | 18 hrs+

To learn how to use CDS in Transactional Application and Create Real-time Project with ABAP® RESTful you can enroll in our ABAP RAP Professional Development Course here.

ABAP Restful
ABAP® Restful