Skip to Content
Technical Articles
Author's profile photo Dipan Ghosh

Event Driven Integration with SAP S/4 HANA Cloud using SAP Event Mesh and SAP Integration Suite


In the current world, an organization wants to get the notification of every event and act on them in real-time, because Business is a series of events. Event-Driven architecture helps us to communicate with different systems in real time when an event is notified.

In Event Driven Architecture, when a change happens within an enterprise system, it triggers an event without knowing what happens after, leaving it to the event router, which means the producer and consumer of the event always remain decoupled. Unlike traditional architecture, it speeds up scalability and agility in business processes.

SAP Event Mesh is a cloud-based capability that allows applications to communicate through asynchronous events. SAP Event Mesh Uses standard and Open messaging protocols like AMQP, MQTT, and Webhook to provide notifications of business events.

This blog details how we can implement event-driven integrations using SAP BTP’s Event Mesh.

Use Case:

Sending real-time Product master/ Material Master information from S/4 HANA Public cloud to Salesforce.

Use Case Architecture:

Our Customer requirement was If any new Product is created in S/4 HANA or any changes are made on the Product Master, it must be replicated in salesforce in real-time. When Product Master data is created or updated in S/4 HANA, it is notified in real-time via the events published by S/4 HANA towards SAP Event Mesh. In turn, SAP Event Mesh routes these events to SAP Cloud Integration. SAP Cloud Integration fetches the required details from SAP S/4 by calling suitable APIs and sends them to Salesforce.

In this blog. I will explain the followings.

  1. How to configure SAP Event Mesh to connect with SAP Integration Suite.
  2. Implementing Event-Driven integration to integrate S/4 Hana Public Cloud with Salesforce using the SAP integration Suite.


  1. Set up Integration Suite. This is necessary to create an Integration flow in SAP Cloud Integration. Please follow the step-by-step process in this Link.
  2. S/4 HANA Public Cloud and Salesforce system details.

Step-by-Step Process:

Configure Event Mesh:

  1. Go to BTP Global account -> System Landscape -> Add System.
  2. Copy Registration Token
  3. Go to S/4 HANA -> Maintain Extensions on SAP BTP -> add new extension. Once the status is enabled, the system is registered.
  4. Go to Entitlements -> Entry Assignments -> Add SAP S/4 HANA Cloud Extensibility and Event Mesh.
  5. Go to SAP BTP Subaccount -> Create an instance for SAP S/4 HANA Cloud Extensibility.
  6. Once the instance is created successfully, Go to S/4 HANA Cloud -> search Apps -> Enterprise Event Enablement – Configure Channel Binding. Here you can see a channel is created. This will be used to publish the events from S/4 HANA.
  7. Go to SAP BTP Subaccount -> Create a Subscription for SAP Event Mesh.
  8. Go to SAP BTP Subaccount -> Create an Instance of SAP Event Mesh. Configure the parameter to subscribe to events.
  9. Go to S/4 HANA Cloud -> Maintain Event Channel Binding -> Create Outbound Topics
  10. ​Go to Event Mesh-> Message Client. You can find both the update and change events published in the message client. This Message client will Publish the S/4HANA events.
  11. Go to Event Mesh -> Message Client -> you can find the newly created Message Client which is created in step 8. This Will be used to subscribe to the events. In the rules section, you can see this instance has “subscribe” permission (JSON parameters have to be configured in step 8).
  12. Create a Queue and Subscribe to the Topics.

Configure S/4 HANA:

  1. Go to the S/4 HANA Cloud system -> Maintain Communication User App. Create a Communication User.
  2. Go to the Communication Systems App in S/4 HANA. Provide System ID and System Name and create a Communication System. In the User for Inbound communication Section, we need to add the User created in the above step.
  3. Now go to the Create a communication arrangement App. In this step, we will create a communication arrangement for Product Master integration. Select the Product Integration Communication Scenario SAP_COM_0009.
  4. In the communication arrangement -> Inbound Services -> Service URL/Service Interface, we can see all the available URLs to integrate Product Master.
  5. In the communication arrangement -> Inbound Services -> Inbound user section we can select the Username to access the above APIs.

Configure Salesforce:

I am not explaining this part in this blog as there are multiple blogs available on how to configure the Salesforce system in SAP Cloud Integration. Check this blog for salesforce configuration.

Design Solution in SAP Cloud Integration:

When a new Product will be created or an existing product will be updated, an event will be triggered towards SAP Event Mesh, and SAP Event Mesh routes these events to SAP Cloud Integration via AMQP Adapter.


  1. Configure AMQP adapter as below. Create OAuth2 Client Credentials in SAP Cloud Integration. Provide the queue name created before.
  2. The incoming payload is in JSON format. Convert the incoming JSON payload to XML.
      "type": "sap.s4.beh.product.v1.Product.Changed.v1",
      "specversion": "1.0",
      "source": "/default/sap.s4.beh/0M2LUKQ",
      "id": "ra163edf-c9b5-1eed-9184-64acca25ee3a",
      "time": "2022-08-09T20:28:47Z",
      "datacontenttype": "application/json",
      "data": {
        "Product": "23"
  3. Extract the Product Number from the incoming body.
  4. Set Application ID as the Product Number.
  5. Get Product Details from S/4 HANA.
  6. Create the product in Salesforce.
  7. Handle Exception: Here I have just put a message logger to check the Exception body.


Now it’s time to check how a product got updated in real-time in salesforce when it was changed in S/4 HANA.

  1. Got to S/4 HANA Cloud -> App Finder -> Search “Product Master” -> Manage Product Master data. Edit an existing Product.
  2. The product got updated in Salesforce in real-time.



In this blog, we discussed how to implement Event-driven integration with S/4 HANA public cloud using SAP Event Mesh service in SAP BTP. This is a central messaging service that gets you notifications when and where events are triggered. Consumers can decide how to use these events. This can be done via SAP Cloud Integration (CPI) or webhooks.

In summary, few key benefits of Event-Driven integration.

  1. SAP Event Mesh instantly reacts to events from SAP S/4HANA, allowing you to create responsive applications and extensions very quickly.
  2. With Event-driven architecture, an organization can improve agility and flexibility very easily.
  3. In an event-driven architecture, messages can be published to multiple target systems at the same time it allowing the application to be in sync.

I hope you enjoyed this blog. Please your thoughts, Ideas about Event-driven Integrations in the comments section.

follow the SAP Integration SuiteSAP Event Mesh Blogs.

Check SAP Integration Suite CommunitySAP Event Mesh Community topic.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Fabien HENIQUE
      Fabien HENIQUE

      Hello Dipan, thanks a lot for this tutos!

      I tried to follow all steps but I'm stuck at step 5 (SAP S/4HANA Cloud Extensibility).

      System name is not part of the list and I cannot go ahead.


      In BTP Global Account, system is flagged as Registered.


      In S/4HC, status is Enabled.


      Any idea?

      Author's profile photo Dipan Ghosh
      Dipan Ghosh
      Blog Post Author

      Hi Fabien,

      Could you please re-do steps 1-4 again? It should work!



      Author's profile photo Fabien HENIQUE
      Fabien HENIQUE

      I re-do from scratch and it works, thanks 🙂

      Author's profile photo Filipe Rieger
      Filipe Rieger

      And what happens if the salesforce endpoint is not available?

      Then the event mesh keeps retrying and retrying every few milliseconds putting high load on CPI, right?

      Or is there a solution for this already?

      Author's profile photo Dipan Ghosh
      Dipan Ghosh
      Blog Post Author

      Hi Filipe,

      There is a solution to this. While creating the subscribe queue you can configure the Max Redelivery count per your requirement.

      Another way is to create one queue that will handle the retry. If an error occurs it will resend the message to the original queue. You can put a small script that will handle the retry count as per your requirement.




      Author's profile photo Filipe Rieger
      Filipe Rieger

      Hi Dipan,

      • first solution will not help for delayed retries. The retries will happen almost immediately. In this very short retry time the target system is most probably still down.
      • With the second solution a delay can be configured with the TTL setting but this whole approach is very intransparent in the CPI monitoring. You will not know if an incoming message is a new one or a retried one. And also failed messages will be shown as "successful" in the CPI monitoring. So at the end of the day you will not even recognized that the messages transmission failed
      Author's profile photo Martin Pankraz
      Martin Pankraz

      Hi Dipan,

      for completeness would be great to add a reference to the co-development with Microsoft for SAP Event Mesh and Azure Event Grid. Especially once you are targeting non-sap integration such as Salesforce.

      @community: Have a look at this video to get started for instance.



      Author's profile photo Saptarshi Sarkar
      Saptarshi Sarkar

      Hi Dipan,


      I have one question when we create a custom app in ADT, Can this event be triggered for any action performed in the app like save/update. If yes then can you please guide me to any blog which puts some light in it.