Introduction to CDS Views
A CDS View (Core Data Services View) is a part of SAP’s modern data modeling approach within the SAP HANA ecosystem. It allows you to define semantically rich database views in a way that is database-agnostic, meaning it works across both SAP HANA and other database platforms, if needed.
What is CDS Views?
➯ Core Data Services (CDS) is a framework for defining and consuming semantically rich views on data.
➯ It provides a higher level of abstraction over SQL and enables developers to focus on the business logic and data structure, rather than on how the data is retrieved.
➯ CDS Views are defined using CDS annotations and can be consumed directly in SAP applications, reporting tools, and in SAP Fiori apps.
➯ CDS provides features such as relationship definitions through associations, built-in functions like currency conversion, extensions, semantic capabilities via annotations, and various SQL enhancements.
CDS was introduced in ABAP 7.40 SP05 and additional features were added subsequently in SP08, SP10, ABAP 7.50 SP00 and so on
Let’s jump into a hands-on example by creating a CDS view in Eclipse.
If you haven’t set up ADT or a Free Trial Account yet, check out our detailed guides on how to set up ADT in eclipse and how to create an ABAP Free Trial account.
Right click on your package ➔ New ➔ Other ABAP Repository
Search Data Definition and select Data Definition as shown below and click next.
Give name and description for your CDS View and click on next. It will ask you for TR. Select your TR or you can create your own TR.
Under View (creation), select DefineView template.
The SQL Name in a CDS view is crucial because it defines the name of the underlying ABAP object generated in the system. This helps ensure that the ABAP runtime environment can properly reference the database object created by the CDS view.
Let’s provide SQLName, data source and list of fields for the CDS View
Let’s provide SQLName, data source and list of fields for the CDS View
How to execute CDS View
Click on Run As ➔ ABAP Application(F8)
You have successfully created you first CDS View. Don’t forget to read next blog post to learn more on CDS View.