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=’saps4omservices’ />
<extension name=’saps4ombackoffice’ />

Below ODATA service API to be used for order creation and Simulation

https://api.sap.com/api/API_SALES_ORDER_SRV/path/post_A_SalesOrder

https://api.sap.com/api/API_SALES_ORDER_SIMULATION_SRV/path/post_A_SalesOrderSimulation

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

 

Fetch%20CSRF%20TOken

Fetch CSRF TOken

Sample%20Payload%20in%20the%20Body

Sample Payload in the Body

 

Please go through the below link to get more information ,

https://help.sap.com/docs/SAP_COMMERCE_INTEGRATIONS/47ad58c1a27447949aad8addbee46fca/f9abb1f960014193a71fe47fc31d93e9.html?q=order%20simulation%20

 

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x