Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
cancel
Showing results for 
Search instead for 
Did you mean: 
Amith_Nair
Product and Topic Expert
Product and Topic Expert
Background:

In S4HANA Cloud, you want to expose your custom CDS View as an OData Service but because there are mandatory parameters linked to it, it’s throwing up an error while forming your web service query. If this sounds familiar, this small little blog is going to help you find the way.

There are some powerful CDS Views that has mandatory Parameters associated to it and few to name in the S4HANA Cloud Space are:

I_ARJrnlEntrItmAgingGrid, I_OverdueAccountsReceivables, I_ARJrnlEntrItmAgingGrid etc.

Often times when calling such OData Entity Sets with Mandatory Paramters results in an EntitySets error.

Procedure:

So let’s start by assuming you’ve already created a custom CDS view using one of the referenced data source mentioned above. In my example, I will consume I_ARJrnlEntrItmAgingGrid for demonstration purpose and have created Custom Scenario to form the Webservice.

Here is my web service url to form the OData Query:

https://my30xxxxx-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_AR_AGING_AS_CDS/

The first step is to identify the metadata and here is how you form your query:

https://my30xxxx-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_AR_AGING_AS_CDS/$metadata?saml2=disab...

Analyzing the log further, you’ll look for the EntityType Name under the Semantics “Parameters”

Furthermore, look for <NavigationProperty Name="Results" under the same parameters Entity Type as depicted in the screenshot below.

Whatever that is listed under NavigationProperty Name will be part of the final Query. In this case it’s the “Results”


Analyze Logs


With this information you’ll be able to form your final query in the below format.

https://my30xxxx-api.s4hana.ondemand.com/sap/opu/odata/sap/YY1_AR_AGING_AS_CDS/YY1_AR_AGING_AS(P_Key...

It has to be noted that the ‘P_KeyDate’ parameter has to be Unix timestamp in seconds.

Summary:

Please note that, currently with 2202 release, we have limitation where SAP has not enabled the support for navigation entities in resource path yet. This would mean that webservices with mandatory parameters will have its limitation while exposing it into middleware or while consuming in SAP Cloud SDK.However,  I hope this gives you some direction on how you can test an OData service in a browser or in an API testing tool using Mandatory Parameters.

Thank you!

Amith Nair