BLOG UPDATES IN PROGRESS!!
Last reviewed for Updates: January 17 2019
SAP S/4HANA Cloud Extensibility – Basics of creating, finding and using OData service in Custom Business Objects and Custom CDS Views
Target Audience – Users/ Developers/Business Experts/Key-Users of SAP S/4HANA Cloud
Blog applicability – SAP S/4HANA Cloud 1708, SAP S/4HANA Cloud 1711, SAP S/4HANA Cloud 1802 and SAP S/4HANA Cloud 1805
The theme of the Blog – This blog will answer following three questions-
- How to enable OData service for Custom Business Objects/Custom CDS Views
- How to know the name of the generated OData Service and enable it for consumption externally
- How to use the service after creating a Custom Business Object or Custom CDS Views and used it in Custom Communication Scenario
In some of the forums and projects, I have been often asked how to find out the OData service after we have created a Custom Business Object or a Custom CDS view in SAP S/4HANA Cloud system. In this blog, I will explain this and would also explain the usage and how to enable it for external consumption.
A note - If you are new to creating a custom business object, please refer to
this blog here before reading ahead. And, if you want to gain more insights into the creation of Custom CDS views in SAP S/4HANA Cloud, please refer to
this blog here before reading ahead.
Let us now understand why we need to know the service when working on S/4HANA Cloud. The answer to this question is - Integration and Extension of SAP S/4HANA Cloud. This means we can enable the resources in SAP S/4HANA Cloud for consumption externally. And for setting this up, SAP S/4HANA Cloud provides following tools-
Under
Extensibility Group-
- We have the tile available called – Custom Communication Scenarios

Fig 1. Screen grab from Fiori Launchpad Extensibility Group
Under
Communication Management Group-
- We have the tiles called – Maintain Communication Users, Communication Arrangement, Communication Systems

Fig 2. Screen grab from Fiori Launchpad Communication Management
These tools help in integrating SAP S/4HANA Cloud after we have set up the Inbound and Outbound communication and provided the OData service. At this point, we need to find out the name of the service and in this blog, we will learn this.
Example 1 - Let’s talk about a scenario where we need to maintain the Custom Business Object from outside the SAP S/4HANA Cloud system. This can be achieved by generating an OData Service on top of the Custom Business Object. Thereafter, you will call this OData service from an external client/Application and populate the Custom Business Object in SAP S/4HANA Cloud system
Example 2 - Another scenario can be when we want the data in Custom CDS View to be available outside of SAP S/4HANA Cloud system. An example of this is when having an application that displays the content of Custom CDS views created in SAP S/4HANA Cloud. To learn about this please visit
this blog
The answer to both the above examples is – we generate OData service on top of a Custom Business Object and Custom CDS views.
How to enable the OData service?
In case of Custom Business Object, we need to select the option
Service Generation. See example below-
Fig 3. Screen grab from
Custom Business Object App
And, in case of a Custom CDS View, we need to select the option
OData API. See below-
Fig 4. Screen grab from
Custom CDS View App
Continue reading to know more about how to find the OData service name for a Custom Business Object and Custom CDS View.
How to know the name of the generated OData service?
In case of both Custom Business Object and Custom CDS views the service name is derived by adding the suffix
‘_CDS’ to it.
So, for example, if the name of the Custom Business Object is
YY1_CUSTOMER_CBO, then the name of the generated service will be
YY1_CUSTOMER_CBO_CDS.
And if the name of the Custom CDS view is
YY1_SUPPLIER_INFO, then the name of the generated service will be
YY1_SUPPLIER_INFO_CDS.
How to use the service in Custom Communication Scenario?
To use the OData service in Custom Communication Scenario, we first need to know the name which we have already learned above. Thereafter, you need to follow three steps in case of both Custom Business Object and Custom CDS Views-
Step 1: Include the service name in the Custom Communication Scenario
Step 2: Create a Communication Arrangement with a Communication User
Step 3: Transport all the objects and consume the service via an external system
Please see the following steps to create a Custom Communication Scenario and use your newly created OData Service for Custom Business Object.
- Open the Custom Communication Scenario App and Click on New

Fig 5. Screen grab from Custom Communication Scenario App
- Next enter the name for a Communication Scenario and a short description and click on New

Fig 6. Screen grab Custom Communication Scenario App
- In the next screen, you would see 3 different options-

Fig 7. Screen grab from Custom Communication Scenario App
Let us understand a little bit about these three options-
- Inbound Services – means when a resource or a design-time artifact from S/4HANA Cloud system is accessed from the external system or environment. For example, you have created a custom CDS view that fetches certain data and you would like to show it externally in some application
- Outbound Services – In simple words, say there is an external service provider and you would like to call that service from within the Custom Logic App or within the Custom Business Object. You can also use Outbound Services to update the data outside of your SAP S/4HANA Cloud System. Consider for example, within the S/4HANA Cloud system in your Custom Business Object you would like to get the updated currency conversion value and then update it in the field in CBO. In such cases, you can create an Outbound Service. To learn more about how to create and use an Outbound Service, please visit this link here
- Communication Arrangements – lists all the communication arrangements created for the custom communication scenario
- Let’s now create an Inbound Service. Select the tab Inbound Services and click on the + icon

Fig 8. Screen grab from Custom Communication Scenario App
- Now in the pop-up, we will provide the service name that was generated after we created our Custom Business Object. If you remember from section ‘How to know the name of the generated OData service’ we already know now that we need to compound the name of the CBO and add the suffix ‘_CDS’ to get the name of the service. We will provide the same in the Add Services pop-up. Select your service and click Ok

Fig 9. Screen grab from Custom Communication Scenario App

Fig 10. Screen grab from Custom Communication Scenario App
- The service would now be added

Fig 11. Screen grab from Custom Communication Scenario App
- In the next step click on Publish button to publish the service for this Custom Communication Scenario

Fig 12. Screen grab from Custom Communication Scenario App
With this your Custom Communication Scenario
YYI_CUSTOMER_CBO_DEMO_CS is ready
OData Service for Custom CDS View
Similar to above example, a OData service would be created by compounding the name of the CDS view and adding the suffix '_CDS'.
For example, see below where the name of our CDS view is - YY1_ProductList, the OData service created for this one would be YY1_ProductList_CDS.

Fig 13. Screen grab from Custom CDS Views
And the name of OData service can be found when creating an Inbound Service under Custom Communication Scenario app

Fig 14. Screen grab from Custom Communication Scenario
The above is an example of creating, finding and using an OData service generated on top of a
Custom Business Object and Custom CDS Views. To learn more and follow detailed steps for Custom CDS view, please visit
this blog here and click on the section ‘Basics of setting up a Side-by-Side scenario in SAP S/4HANA Cloud’
Congratulations you have successfully learned the basics of
why we need OData service,
how to create it for Custom Business Object and Custom CDS views in SAP S/4HAHA Cloud!
Rohit Khan, S/4HANA Regional Implementation Group