API extensibility in SAP S/4HANA Cloud and monitoring with SAP AIF
When we talk about cloud, its about delivering the standard business processes however during the integration of one cloud system with another, we might require some additional fields to be created and sent to the communicating system. SAP S/4HANA Cloud offers this capability and one means of it, is via extensibility of APIs.
In this blog I will show the step by step procedure of adding a custom field in a SOAP API and pushing this data for creating the respective business object in SAP S/4HANA Cloud.
In the example here, I would run through the following:
- Extending an inbound SOAP API ‘OrderRequest_In’ (used for creating a Sales Order in SAP S/4HANA Cloud) with a custom field and make this custom field visible in Sales Order UI as well
- Setup the Communication Management for this API
- Push the relevant data into SAP S/4HANA Cloud via XML Payload including the custom field
- Monitoring Sales Order creation in ‘Message Dashboard’ application enabled by SAP AIF and the ‘Display Sales Order’ application of SAP S/4HANA Cloud
1. Extending an inbound SOAP API ‘OrderRequest_In’ with a custom field and make this custom field visible in Sales Order UI:
1.1 Logon to SAP S/4HANA Cloud system with Key User and Launch ‘Custom Fields and Logic’ application:
1.2 Create a new field by entering the required properties like Business Context (Sales Document in our example), Label, Field Type and Length. I am creating ‘Partner No.’ in this example:
1.3 Enable its usage in SOAP API under ‘SOAP APIs’ section and also in the required user application(Sales Document GUI) under ‘UIs and Reports’ section and ‘Publish’ the field::
2. Setup the Communication Management for this API:
2.1 To enable the use of this API we would need to setup Communication User, Communication System and Communication Arrangement with respect to the Communication Scenario of API (SAP_COM_0223 in our example):
For more details on setup of Communication Management you can follow my earlier blog by clicking here.
Note: In this example we would only use the inbound service hence we may deactivate the outbound services in Communication Arrangement. However create a new Outbound User in your Communication System in addition to adding the Communication User as Inbound User (otherwise you might run into an error of no outbound user while activating the Communication Arrangement).
3. Push the relevant data into SAP S/4HANA Cloud via XML Payload including the custom field:
3.1 The service URL can be copied from Communication arrangement and also the respective WSDL file can be downloaded from there itself. The authentication would happen via Communication User created in earlier step.
Note: There can be multiple ways for testing the XML containing the required data to hit the service URL. Customers generally use SoapUI / Postman(external 3rd party tools) however it is completely left on the individual and these 3rd party tools are not delivered as part of SAP S/4HANA Cloud.
3.2 Once a request to send the payload is successful, the HTTP status in the tool would become ‘202’ – Accepted.
4. Monitoring Sales Order creation in ‘Message Dashboard’ application enabled by SAP AIF and the ‘Display Sales Order’ application of SAP S/4HANA Cloud:
SAP Application Interface Framework (AIF) provides ability monitor interfaces and their data messages with less IT support enabling efficient and cost effective approach of Interface monitoring and error handling.
More details on monitoring with SAP AIF can be found here.
Business Role Required: SAP_BR_CONF_EXPERT_BUS_NET_INT
4.1 [Prerequisite for using ‘Message Dashboard’ application]– Assign user to namespace (/SDEDI in my example) in ‘Assign Recipients’ application (under the group ‘Communication Management- Message Monitoring’) to enable monitoring for this user:
4.2 Launch “Message Dashboard” application for monitoring and error handling and we can see here the success/failure messages with regards to our request:
4.3 Launch the “Display Sales Order” application, and display the respective Sales Order header, navigate to Custom Fields. The data sent for the new field(Partner No.) which we added in Step 1 can be seen here:
These steps shows how SAP S/4HANA Cloud allows the custom fields to be added in API to enable seamless integration.
Note: Not all the APIs are currently extensible. If an API is extensible, it shall be visible in “Custom Fields and Logic” application, like the API used in example here.
Disclaimer: This blog is based on SAP S/4HANA Cloud 1802 release. Only the test/dummy data is used in this blog.