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: 
varunvenkat
Product and Topic Expert
Product and Topic Expert
0 Kudos

In product master data in S/4HANA Cloud, there is a classification section, in which master data pertaining to international trade is maintained. This includes commodity codes and customs tariff numbers for example. In the standard public APIs available for reading product master data in S/4HANA Cloud from an external system, these international trade details are not accessible to be read as part of the API payload. To achieve the desired result, a possible consulting solution is to create a custom CDS View, which can be published as a custom external API and later consumed from an external system much like any other public API.

In this blog, I’ll be using the customs tariff details as an example to demonstrate the steps involved to achieve the desired results.

  • In the app “Custom CDS View”, create a new custom CDS view of the category external API.

varunvenkat_5-1709916662552.png

  • As a data dource, choose ‘C_ProdCstmsTrifNmbrForKeyDate’
  • Under the “Parameters” tab, remove the default parameter P_KeyDate
  • Under the “Elements” tab, you can add additional fields such as CustomsTariffNumber, Country or ValidityEndDate that you might want to consume through the external API.
  • Publish the Custom CDS View.

The next step involves creating a custom communication scenario and arrangement in order to expose the data from the Custom CDS View as an external API. As a prerequisite, a communication system and user will also be required (a guide on how to create these can be found here).

  • In the app “Custom Communication Scenarios”, create a new scenario. Give it a name, and in the inbound services section, add the ID of the Custom CDS View that was previously created.
 

varunvenkat_6-1709916697195.png

  • Save and publish the scenario.
  • Next, create a communication arrangement. In the app “Communication Arrangements”, create a new one and select the custom scenario ID from the previous step.
 

varunvenkat_7-1709916714428.png

 

  • Choose the communication system and inbound user you would have created as a prerequisite and save the communication arrangement.
 

varunvenkat_4-1709916613171.png

  • You can now use the service URL as the API endpoint while consuming data from this Custom CDS View from an external system. The credentials of the communication user will be used to authorize the external system to read this data.
  • At the end of the Service URL, you will need to append the name of the custom CDS View, so your final endpoint URl would look something like this:
    https://myxxxxxx-api.s4hana.cloud.sap/sap/opu/odata/sap/YY1_CUSTOMSTARIFFAPI_CDS/YY1_CustomsTariffAP...
  • As a test, you can use Postman to simulate the result of reading the data from this Custom CDS View. In the Authorizations tab, you will need to specify your inbound communication user and password that were created as a prerequisite.

Hope this blog showed you how you can consume international trade details of products in S/4HANA Cloud from an external system.