How To Create A Basic CDS (Core Data Services) View?

CDS (Core Data Services) is a powerful tool in SAP that enables the creation of virtual data models by defining structured views on top of SAP HANA tables. It provides a high-level, declarative way to work with data, allowing you to define complex queries without having to manually write low level SQL.

The queries are executed directly in the SAP HANA database layer not in the SAP application layer, leveraging HANA’s in-memory computing capabilities. This approach is also known as code pushdown, that will optimize performance by shifting the heavy lifting of data processing to the database layer.

In this tutorial, we’ll use Eclipse to create the CDS view and run the view in Eclipse.

What you will learn
1. Create CDS DDIC View using Eclipse
2. Learn how to run CDS view in Eclipse
Prerequisites
1. SAP System Access: SAP GUI, ECC, Eclipse
2. Authorization: Developer role, TCODE: SE38.

Now let’s begin create the CDS view by following the steps below.

Step 1. Open Eclipse, right click any package name (for this tutorial I’m using $TMP package), select New and the select Other ABAP Repository Object.

Step 2. Find Core Data Services, select Data Definition and then click the Next button.

Step 3. Enter the name and description of your CDS view and then click the Next button.

Step 4. If you’re also using $TMP package then just click Next, in the next wizard screen, select defineView and the click the Finish button.

Step 5. The first section of CDS View template is the metadata, also called annotations. (it starts with @), we can use these annotations to provide more information about the elements of a CDS view.

For example: @AbapCatalog.sqlViewName is used to define the ABAP Object name which is maintained in SE11. @EndUserText.label is used for the CDS view Short Description in ABAP dictionary.

Now enter the annotation @AbapCatalog.sqlViewName: ‘ZCDSCARRFLIGHTS’ (this will be the object name in ABAP dictionary) .

Next, write the SQL query in the define view section as shown below.

Step 6. Click Save and Activate.

The CDS View that we’re creating right now is called CDS DDIC-Based Views, meaning that upon activating the CDS View, the DDIC object is also created in the ABAP Dictionary using the name we defined in @AbapCatalog.sqlViewName annotation which is ZCDSCARRFLIGHTS and it also created the CDS entity which is ZCDS_CARR_FLIGHTS, so this type of CDS view will generate several different names and database objects.

Now if you open TCODE: SE11 and enter ZCDSCARRFLIGHTS in the database table field and click the Display button, then you will see the CDS view structure.

The latest CDS view in ABAP release 7.55 is called CDS View Entities, that offer simpler Query, single database object and also maintain in a single name. Learn about the difference between CDS DDIC and CDS View Entities.

Step 7. Test the CDS View using FN+F8 key in your keyboard.

Conclusion

CDS view is a powerful tool that aligns with SAP’s move toward a data driven and cloud-read, in-memory architecture. It simplifies development, optimizes performance, and enhances the user experience in modern SAP landscapes.

Share this tutorial with Fellow Geeks!

Other ABAP Tutorials

Leave a Reply

Your email address will not be published. Required fields are marked *