Synchronous order creation & simulation in Commerce
In this article we try to cover what necessary changes to be done at commerce to have a synchronous communication between S/4 HANA. We also try to cover if we have to do some customisation in request and response then how we should do it
SAP Commerce integration with S/4 HANA can be done in 2 ways
- VIA SCPI ( Synchronous & Asynchronous communication)
- ODATA Services ( Synchronous communication)
We discuss here about ODATA service integration and Commerce side changes only.
To enable synchronous communication with S/4 HANA below 2 extensions are to be added in localextensions.xml file
<extension name=’saps4ombackoffice’ />
Below ODATA service API to be used for order creation and Simulation
BTP team will refer the API structure and perform the necessary mapping from their side and provide the endpoint URL & credentials. This endpoint can be easily validated from Postman
While testing using POSTMAN first fetch the X-CSRF-TOKEN token and then set the authentication & token for communication
Communication Using BTP(SCPI)
If we decided to use then we do not have to do any networking configuration at CCv2 side , only certificate exchange between SCPI and Commerce CCV2 system is enough to establish connection with necessary credentials
Communication using direct call to S/4 HANA
if we decided to have a direct call with HANA using ODATA services we need to perform certain network configurations at CCV2 side
- Enable VPN connectivity between CCV2 & HANA network , create NAT endpoint and use that end point for communication,
- HANA side need to create user credentials for authentication
If the above option not possible then certificate auth can be done by sharing the signed certificate & private key
Customising Request and Response:
The payload you send via BTP or direct to HANA is same.
We can easily customise our commerce request and response structure using predefined hooks
- sapS4OMRequestPayloadCreator: The request payload is generated in this service and passed to sapS4OMOutboundService. The service provides requestPayloadModifierHooks if the customer wants to modify the payload.
<util:list id="requestPayloadModifierHooks" value-type="de.hybris.platform.sap.saps4omservices.services.RequestPayloadModifierHook"> <ref bean="customRequestPayloadModifierHook" /> </util:list>
- sapS4OMResponseProcessor: The service provides responsePayloadModifierHooks if the customer wants to modify the payload.
<util:list id="responsePayloadModifierHooks" value-type="de.hybris.platform.sap.saps4omservices.services.ResponsePayloadModifierHook"> <ref bean="customResponsePayloadModifierHook" /> </util:list>
Testing Using Postman
Fertch the CSRF TOKEN first using the URL given by BTP/HANA team , after getting the CSRF token , pass in the header with the Payload
Please go through the below link to get more information ,