Skip to Content
Author's profile photo Shivankit Bisht

Consumption of CDS in an OData Service

Consumption of CDS in an Odata Service


1. In Hana Studio, ABAP Development Perspective click on add a new ABAP Project. From here you can directly add  your SAP System to your Studio. Login details

    remain the same as your SAP Logon.

/wp-content/uploads/2016/09/1_1043299.png



2. After the system is added you can see it Righ hand side in you r Project Explorer. Right click on it and select DDL source. You can create these repository artifacts as local  

    objects belonging to the $TMP package.


/wp-content/uploads/2016/09/2_1043318.png




3. Provide a source table or view and give a SQL view name. Select all the field that you might require on your UI. (TIP: Press Ctrl+Enter to bring the entire list help of fields.)


/wp-content/uploads/2016/09/3_1043319.png





4. Now, Give some annotation to make the data more readable on UI. Annotations allow to enhance the core meta model with consumer-specific vocabularies. For eg. @EnduserText.label will give the UI label for the partner field.


/wp-content/uploads/2016/09/4_1043320.png


5. Now to register the Odata service , go to the transaction segw in the same system in the ABAP System and click on create project.

/wp-content/uploads/2016/09/5_1043321.png

6. Provide the CDS data source and give the CDS name.

/wp-content/uploads/2016/09/6_1043322.png

/wp-content/uploads/2016/09/6b_1043323.png

  

7. Now click on Generate Runtime Objects.

/wp-content/uploads/2016/09/7_1043327.png

8. Now click on Register Service to create a service in the system. Here we will select ER9. Provide alias as local and package as $temp.

After successful registration the registration status will show in Green.



/wp-content/uploads/2016/09/8_1043328.png




9. Now click on SAP Gateway Client Button. There click on Execute.


/wp-content/uploads/2016/09/9_1043329.png



10. So after this we need a UI for our service. This we can do in WebIDE


https://code-fiori.dispatcher.cert.hana.ondemand.com/



/wp-content/uploads/2016/09/10_1043333.png


11. Select Smart Template Application


/wp-content/uploads/2016/09/11_1043334.png

/wp-content/uploads/2016/09/11b_1043335.png

/wp-content/uploads/2016/09/11c_1043339.png

Click Finish.


12.   Finally, it’s time to run our project. Click on the green Play icon on the top.

/wp-content/uploads/2016/09/12_1043340.png

And, this is the final result.


/wp-content/uploads/2016/09/13_1043341.png



Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Former Member
      Former Member

      Nice Documentation

      Author's profile photo Prasad Pomaji
      Prasad Pomaji

      Very well explained. Helped in creating a small(but fast) end to end project with CDS view-oData service-UI.

      Thanks for the document.

      Author's profile photo Rabert Kumar
      Rabert Kumar

      Very useful documentation.

      Thank you Shivankit Bisht.