Creating OData Services from CDS Views

Hello Blogers and Blog Readers,

Developing with CDS Views and Eclipse, which have completely entered our lives as ABAP Developer, is becoming increasingly indispensable. In this blog, I will tell you how to create a cds view from eclipse and create an Odata service from there.


1. We are creating our CDS view.

Right click on the package or Local package that we created and select the new “Other Abap Repository” and Data Definition from CDS.


2. We are setting fields for our CDS view.

Then we select any table from se16n and its Fields for our CDS View. I used from the EKKO table; Purchasing Doc. , Company Code, Doc. Category, Document Type, Create Date and Create By fields.

I saved the field titles in my language to show the AS tag.

We can examine the structure of the CDS we have created from se11.


3. We add ODATA annotations to our CDS View structure.


A yellow warning appears on this line. It says the services are not active. We go to services with the /n/IWFND/MAINT_SERVICE Tcode.

We click on Add Service and find the Service name as same as CDS Name that we created and activate it.


4. We activate our CDS without error and warning.


4. Finally, we go to the services and test our Odata.


Thank you for taking the time to read my blog post.


CDS View Code:

@AbapCatalog.sqlViewName: 'ZFRT_S_LR'        //ABAP Interface name , that should be different from view name
@AbapCatalog.compiler.compareFilter: true
@AbapCatalog.preserveKey: true
@AccessControl.authorizationCheck: #CHECK   //Access Control
@EndUserText.label: 'CDS View Entity for List Report'

@OData.publish: true 'PODataSet'

define view ZFRT_C_LR as select from ekko   //Data source can be -> Table or existing CDS view 
    key ebeln as SatinAlmaDokumani,
    bukrs as FirmaKodu,
    bsart as DokumanTipi,
    bstyp as Dokumankategorisi,
    ernam as Olusturan,
    aedat as OluturmaTarihi

Original Article:

Related blogs


Please enter your comment!
Please enter your name here