Technology Blog Posts by Members
cancel
Showing results for 
Search instead for 
Did you mean: 
former_member706122
Participant
7,064
Premise-

There are many SAP blogs out there that explains inner working of CDS views or core data services in SAP’s S/4 boxes. But there are still struggle among experienced professionals who is switching from ECC system to S/4.

This blog is dedicated towards experienced professionals working on ECC systems for many years and yet to jump to S/4.In the next few min, we will look at a very basic concept of a CDS view and try to evaluate inner working of the CDS using classic SAP tools.

 

Pre-Requisites –

You have read / understood / Prototype items on Previous blogs.

SAP CDS for New And Experienced professionals | SAP Blogs

Consuming CDS for – New And Experienced professionals- 2 | SAP Blogs

CDS Annotations for – New And Experienced professionals- 3 | SAP Blogs

CDS in Real life requirements – New And Experienced professionals- 4 | SAP Blogs

CDS Architecture – New And Experienced professionals- 5 | SAP Blogs

 

Recap-

We started this journey with creating a simple CDS for a custom table in the first blog.

In the second blog we looked at simple way to consume CDS views in ABAP executables.

Took a deep dive into annotations in third blog.

Finally looked at an approach to extend CDS views.

All concluded on CDS Architecture.

 

Target-

Current blog will be a overlap between CDS and ODATA topics. We have already looked at option to consume CDS in any ABAP executables, this blog will explain how to expose CDS as a service using ODATA.

 

 

Lets Start –

In First blog we created a data dictionary table named ZTRAVEL and a CDS view ZCDS_TRAVEL.

In this blog we will try to create a ODATA service to expose the CDS view.

 

Step1: Create a new sub package ZTRAVEL_BOOKING_ODATA in main ZTRAVEL_BOOKING package. Go to transaction SEGW- (SAP Gateway Service Builder). Click on the new ICON.


Step2: Create a new ODATA project named - ZODATA_ZCDS_TRAVEL ( ODATA Project for CDS Service ZCDS_TRAVEL). Enter the package ZTRAVEL_BOOKING_ODATA click on OK.


This will create an Empty service.


 

Step3: Lets enter a data model by right clicking the data model and click on import-> DDIC Structure.


 

Step4: We will import the SQL view in this case ZVSQL_TRAVEL with the entity as CdsTravel.


Step5: You can choose the fields that you would like to expose as part of this ODATA - In this case choose everything except client / Mandt.


Select Employee No as key click on finish.


This actions will create Entity sets and Service Implementation will be visible.


 

Step6:  Right Click on Service implementation CdsTravelSet and click on MAP to Data Source.


 

Step7: Find the CDS view via SADL model as shown below and click ok.


 

Step 8: Click on Generate Run time object button from toolbar. This will generate the below items automatically click on Ok. Do no worry about what they are I will explain in the up coming blog in details. Save the service.


 

Step9: Go to transaction /IWFND/MAINT_SERVICE in a new window. Click on Add service - Search technical service Z*CDS* you will find the service we just created in Step 8. Once you find it select the service and click on Get service.



Step10: click ok.


Step11: If you have completed successfully the following message should appear.


 

Conclusion:

In exact 11 steps we were able expose CDS service as a ODATA. Congratulations, Keep learning.

 

 
8 Comments