Skip to Content


The purpose of this blog is to show how HANA Artifact CDS view can exposed as Odata service to consumer.

1 CDS (Core Data Services) Views

CDS(Core Data Service) views  is the newest kid in the block in HANA . It allows you to do much more compared to classical view

  • Push Code to Data  Base layer by allowing queries ,calculations and imperative statements at the DB layer(instead of application service layer)
  • Allows you to add associations with other business entities/tables
  • Annotations to semantically describe your data model

I am not going to get vociferous about CDS because there is enough documentation already available .

Please refer this ABAP on HANA open sap course for more details.

For creating CDS views there are some prerequisites

  • Eclipse should be installed
  • ADT(Abap Development Tools) add on should be installed
  • SAP NetWeaver AS ABAP 7.4 SP05 or higher running on a SAP HANA database SPS6 should be available

The ABAP system in which I am trying is NW7.4 SP8 system

Once we are done with prerequisites , we will create a CDS view .

This CDS view will join tables SNWD_SO(Sales Order) and SNWD_BPA (Business Partner) and find out sum of invoices whose gross amount is greater than 10000000.

@AbapCatalog.sqlViewName: 'ZDDLS_CDS_AGGR'
@EndUserText.label: 'CDS view for aggregation'
define view Zars_Cds_Aggr as select from snwd_so as so
inner join snwd_bpa as bpa
on so.buyer_guid = bpa.node_key
{ key bpa.bp_id as BusinessPartner,
  sum( so.gross_amount ) as  Total_Gross_Amount,
group by
    having sum(so.gross_amount) > 100000000

Here you can see there are two views – The View ZDDLS_CDS_AGGR is DDLS(DDL source view) name which can be viewed in SE11 and this object is integrated with the CTS (Change and transportation system) .The other view ZARS_CDS_AGGR is the CDS view name

Now we will check the results of the CDS Views. We can do it in two ways

a Open Data preview of CDS view in Eclipse


Now the results


b You can see the result in classical se11 transaction also. But this time we should give the DDL SQL view name ZDDLS_CDS_AGGR


2 Data Modelling in Gateway Builder

As we are done with CDS view building , we will move to Gateway data modeling part . The good thing here is we don’t need to switch to GUI for Gateway builder transaction. We can run the SEGW transaction from eclipse itself as an embedded GUI. Just press CTRL+SHIFT+A and give SEGW ๐Ÿ™‚ .

We Create  data model based on DDLS view ZDDLS_CDS_AGGR



Click on Next button


select the properties we want in the entity( ignore the MANDT field)


Here we can see the property names of the entity has been automatically adjusted (Camel case) and we need to mark the Business Partner as the key property of the entity

Press finish to complete the data model part

3 Service implementation

Now we are done with Data model , we look into the data provisioning part.

Here we give the data source name as CDS view name ZARS_CDS_AGGR

Right click on the entity set SalesAggregationSet under service implementation and select Map to Data source . The important point here is we are not mapping the GetEntitySet operation of the entityset but the entityset itself.


We have to select type as Business Entity and use F4 help to select CDS view  ZARS_CDS_AGGR.


We then do the mapping of Entity properties with the CDS view fields. Strangely propose mapping button seems to be not there


Generate the model and do the service registration

4 Testing

Now we head to GW client for testing . We test the SalesAggregationSet.


In the above case we have not implemented the query operation but we use the URL of the query operation to get the CDS view results .

One more thing that comes free is the read operation .No separate implementation of READ ๐Ÿ™‚ (GET_ENTITY) required.

So if We put the below URL

/sap/opu/odata/SAP/ZARS_CDS_SIMPLE_SRV/SalesAggregationSet(‘100000014’) also, we get the results



ABAP is not only ‘ABAP’ right now . For a complete End to End scenario , now we need to proficient across three layers (ABAP,Gateway,UI) which seems to be close to impossible .  But as  grey haired ‘Abaper’ , it is required that we at least keep up to date with  how ABAP is evolving itself for HANA DB and how its pushing the changes  in Gateway layer. The easiest solution will be to ignore all the changes happening around us and stick to the old classical style. But that will be a gap too big to bridge

To report this post you need to login first.


You must be Logged on to comment or reply to a post.

  1. Former Member

    Hello Arshad,

    good that you have shared this information. May be you can also share the component details/ prerequisites for this feature as this is will not be available by default.


      1. Former Member

        hi Arshad,

        i do not have the Business Entity in the list of map to data source.

        i am using netweaver 740 with sp08


        Do you have any idea?



          1. Former Member

            Hi Arshad,

            thank you very mush. i found this under the context menu of the Entityset.

            and also noted that you have already pointed that out in your blog ๐Ÿ™‚



  2. Former Member

    Hi Arshad,

    Nice blog and You opened doors for good exploration in ABAP. I like your comment updating knowledge on technology.


  3. Shakul Jugran

    Hello Arshad,

    I liked the way you explained it all in layman’s terms. Also, the last paragraph made for some fun reading as well ๐Ÿ™‚



  4. Former Member

    Hello Arshad,

    I have a strange problem, I can’t perform Map to Data Source.

    Every time I try that the system just freezes and I get no error prompt. I have tried different approaches and nothing seems to work. Do you have any idea why?

    Thank you very much,


    1. Arshad Ansary Post author

      Hi Indra,

      I also faced this problem while doing it via Eclipse. Can you try logging in via R/3 Gui SEGW tranxn  and try the same?


      1. Former Member

        Yes Arshad, thank you very much. I tried using my usual SAP Logon and it worked wonders. Thank you for the prompt and the tutorial.



  5. Prashanth Prabhu

    Hi Arshad,

    you talked about the Get Entity set and Read. what about Create and Update?

    is it possible via the CDS ? can you throw some light what are the steps.


    1. Andre Fischer

      Hi Prashanth,

      no, this is not possible.

      You can however redefine the CREATE, UPDATE and DELETE method of the data provider extension classes and implement these methods so that your service will support all CRUD-Q methods.

      Best Regards,


  6. Former Member

    Nice blog Arshad!

    I followed the steps and my OData is created with a CDS view.

    But for testing I have some problems:


    Does somebody has the same problem of knows the solution?

    Thanks in advance!

    Kind regards,


  7. Former Member

    Hi Arshad,

    Very nice information. I was tried to follow the blog but one error was coming while mapping the data source step.ย  It shows the following error.

    Can u please explain me the reason.

    Thanks in Advance,

    Babu Reddy.M


Leave a Reply