Setup Event Mesh – Integration Suite (EMIS) to Trigger Events from S4H Cloud to CPI via Webhooks

Estimated read time 15 min read

In this blog, we’ll walk through a step-by-step guide to setting up SAP Event Mesh – Integration Suite (EMIS) to enable real-time event-driven communication between SAP S/4HANA Public Cloud (S4HC) and Cloud Integration.

This tutorial covers the flow from configuring Event Mesh – Integration Suite to receive events from S/4HANA Public Cloud and briefly touches upon a sample HTTP based endpoint exposed by a SAP Cloud Integration (CPI) iFlow to which the events are pushed via Webhooks. Below Solution Diagram depicts the message flow. Please note that Queue 2 is presented solely for illustrative purposes and is not discussed within the scope of this article.

Solution Diagram-

 

Whether you’re new to SAP’s Event-Driven Architecture or looking to integrate cloud systems in a more responsive and scalable way, this guide will provide you with a clear and practical implementation path.

 

Prerequisites-

Available only for SAP Integration Suite standard and premium editionsIf present, remove the instance of Standalone Event Mesh (Default Plan) from your SubaccountIntegration Suite service is already subscribed to in the subaccountIntegration Suite Event Mesh is added as an entitlement in the Global account

Refer SAP Note 3461547 for more details like Region Availability.

 

Detailed Steps-

Go to BTP Tenant’s Integration Suite instance.   

             

       2. Click on Manage Capabilities

       3. Click on Add Capabilities

       4. Click on Manage Business Events and then click on Next

       5. Click Activate

           It’s now Active

      6. Click on OK and proceed

We can now see the Manage Business Events tile. But none of the hyperlinks are yet active. This is because the necessary roles are still to be added to your user.

        7. Go back to your BTP Subaccount and go to Security -> Users option

        8. Search for your user and click on it

        9. Click on Assign Role Collection.

      10. Search for Event in the search bar. This will display 2 Integration Suite Event Mesh specific roles. Select both these roles and click on Assign Role Collection.

           Both these roles are now assigned to your user.

      11. Refresh the Integration Suite screen. We can now see the hyperlinks for Configure Events and Monitor Events in the Manage Business Events tile as shown below

      12. Click on Configure Events link.

This will open the below screen. Click on Activate to enable Event Mesh capability

 

A notification will appear confirming that event mesh is successfully activated.

 

Wait for some time, event mesh will now show as active-

 

If it shows as failed here, you might want to check the 2nd point under Prerequisites, where it has been suggested to remove the instance of Standalone Event Mesh (Default Plan) from your Subaccount, if applicable in your case.

13. Click on Queues tab to create a new queue. Click on Create button.

14. Give a name to the queue and click on Create-

15. Go to SAP BTP Subaccount and create a Messaging Client to receive messages from Topics in S4H Public Cloud

16. Create a space named “INTEGRATION_TOOLS”, or any other name of your choice. Use an existing space, if already available.

 

Note that this step needs the “Integration Suite Event Mesh” entitlement to be added in Global account as mentioned in the Prerequisites section.

 

17. Click on Create to create an Instance of Event Mesh

Select Service as “SAP Integration Suite, Event Mesh” and other parameters as shown below. Take note of the Instance Name you provide, since this would be needed later during S4HANA Public Cloud configurations.

Instance creation will show as In progress initially-

Click on the Message Clientem-client-s4h” when it’s created-

Click on Create under Service Keys

Give it an appropriate name and click on Create

Copy this JSON content for use later in S4HC while creating the communication arrangement.

19. Move over to S4HCloud system and open Communication Arrangements app. Click on New.

Search for Scenario 0092, which is meant for Enterprise Eventing Integration.

Give an appropriate name to the arrangement, assign user “CPI” (or any other comm user as suitable in your case) and paste the Service Key we created earlier and click on create.

This will throw the below error message, which is expected. This error is thrown because we haven’t given any Topic namespace which will help S4HCloud to post this correctly to the Message Client we created in BTP when it is subscribed to a Topic in S4HCloud.

Click on close.

Add a namespace field with a value as em/client/s4h. This name is similar to the Message Client name. Just replace the “-” with “/”

Add it back to the Service Key and click on Create.

This is now displaying the new Communication Arrangement that has been created. You can now see the topic space added.

20. Add these 2 apps – Enterprise Event Enablement (Event Monitor) and Enterprise Event Enablement (Configure Channel Binding) to your home screen in S4HC

21. Go to Enterprise Event Enablement (Configure Channel Bindings)

22. Click on Channel “EMIS_0092” which was generated in the previous step

23. Click on Create under Outbound Topic Bindings

24. Search for Events

/sap/s4/beh/businesspartner/v1/BusinessPartner/Changed/v1

/sap/s4/beh/businesspartner/v1/BusinessPartner/Created/v1

Click these one by one and click on Create

 

 

 

You can now see both the Topics are added to the outbound channel “EMIS_0092”.

S4HC is now ready to send Business Partner – Create and Change events.

25. Go back to the Queue in BTP to subscribe to these 2 Topics

Click on the queue Tab

26. Go to Subscriptions tab and click on Create

27. Paste the Topic names here one by one.

Note that the topic subscription should have the format – namespace + /ce + /topic name

Example in our case-

em/client/s4h + /ce + /sap/s4/beh/businesspartner/v1/BusinessPartner/Created/v1

You need to manually paste these 2 Topics

em/client/s4h/ce/sap/s4/beh/businesspartner/v1/BusinessPartner/Changed/v1

em/client/s4h/ce/sap/s4/beh/businesspartner/v1/BusinessPartner/Created/v1

Do it for each of the Topics and click on Create

You can now see the 2 Topics being subscribed to.

28. Go to Overview tab of Event Mesh and click on the Message Clientem-client-s4h

This will open the Webhooks configuration screen. Click on Create.

Use the below HTTP CPI iFlow Endpoint as the Webhooks URL

https://<TenantURL>/http/BPReplicationToSalesforce

You need to create a CPI iFlow with a HTTP Sender Channel, whose endpoint will then act as a Webhooks URL as shown above.

Click on Create

The webhooks should now forward any messages that appear in this queue to the iFlow meant for SAP to Salesforce BP sync.

Below is a sample CPI iFlow that was used for this Demo. You can implement as per your requirement.

Brief details of the CPI iFlow Steps-

Business Events Message is received via a HTTP Sender Adapter.

The payload format of the incoming event notification payload is as given in the below SAP API Business Accelerator link.

https://api.sap.com/event/CE_BUSINESSPARTNEREVENTS/resource

       2. The BP number needs to be extracted from this payload.

       3. A call needs to be made to S4HC Business Partner OData API to fetch additional details for the Created or Changed Business Partner.

       4. Map to the corresponding structure of Accounts object of Salesforce

       5. Finally, send the payload to Salesforce API.

 

This completes the configuration setup, enabling the integration to capture and forward any Business Partner updates to the downstream systems.

As shown in the Solution Diagram earlier, you can create additional queues for other subscribers who are interested in receiving the same or other events and subscribe them to the required Topics of interest.

 

Scaling Up with Advanced Event Mesh (AEM)-

As your message size requirements grow, you can seamlessly transition to the more robust Advanced Event Mesh (AEM), which offers enhanced scalability and performance as compared to Integration Suite – Event Mesh (EMIS).

Refer below materials-

https://learning.sap.com/learning-journeys/discovering-event-driven-integration-with-sap-integration-suite-advanced-event-mesh/examining-sap-integration-suite-advanced-event-mesh_ce4073de-a466-4ac3-a2bc-4324b8b08b26

https://help.sap.com/docs/sap-integration-suite/advanced-event-mesh/what-is-sap-integration-suite-advanced-event-mesh

 

We have now reached the end of this blog post. I hope you found the content useful and that it helped clarify the setup and capabilities of SAP Integration Suite’s Event Mesh. Whether you’re just starting with event-driven architecture or exploring advanced options like Advanced Event Mesh (AEM), I’d love to hear your thoughts.

If you have any questions, face issues during your setup or simply want to share your experiences, feel free to drop a comment below. Your feedback is always welcome and can also help others in the community facing similar challenges.

 

References-

SAP Community-

https://community.sap.com/t5/technology-blog-posts-by-sap/meet-your-new-friend-emis-event-mesh-in-sap-integration-suite/ba-p/13731129

Youtube-

https://www.youtube.com/watch?v=tUIG34xT3oo&t=3587s

 

​ In this blog, we’ll walk through a step-by-step guide to setting up SAP Event Mesh – Integration Suite (EMIS) to enable real-time event-driven communication between SAP S/4HANA Public Cloud (S4HC) and Cloud Integration.This tutorial covers the flow from configuring Event Mesh – Integration Suite to receive events from S/4HANA Public Cloud and briefly touches upon a sample HTTP based endpoint exposed by a SAP Cloud Integration (CPI) iFlow to which the events are pushed via Webhooks. Below Solution Diagram depicts the message flow. Please note that Queue 2 is presented solely for illustrative purposes and is not discussed within the scope of this article.Solution Diagram- Whether you’re new to SAP’s Event-Driven Architecture or looking to integrate cloud systems in a more responsive and scalable way, this guide will provide you with a clear and practical implementation path. Prerequisites-Available only for SAP Integration Suite standard and premium editionsIf present, remove the instance of Standalone Event Mesh (Default Plan) from your SubaccountIntegration Suite service is already subscribed to in the subaccountIntegration Suite Event Mesh is added as an entitlement in the Global accountRefer SAP Note 3461547 for more details like Region Availability. Detailed Steps-Go to BTP Tenant’s Integration Suite instance.                       2. Click on Manage Capabilities       3. Click on Add Capabilities       4. Click on Manage Business Events and then click on Next       5. Click Activate           It’s now Active      6. Click on OK and proceedWe can now see the Manage Business Events tile. But none of the hyperlinks are yet active. This is because the necessary roles are still to be added to your user.        7. Go back to your BTP Subaccount and go to Security -> Users option        8. Search for your user and click on it        9. Click on Assign Role Collection.      10. Search for Event in the search bar. This will display 2 Integration Suite Event Mesh specific roles. Select both these roles and click on Assign Role Collection.           Both these roles are now assigned to your user.      11. Refresh the Integration Suite screen. We can now see the hyperlinks for Configure Events and Monitor Events in the Manage Business Events tile as shown below      12. Click on Configure Events link.This will open the below screen. Click on Activate to enable Event Mesh capability A notification will appear confirming that event mesh is successfully activated. Wait for some time, event mesh will now show as active- If it shows as failed here, you might want to check the 2nd point under Prerequisites, where it has been suggested to remove the instance of Standalone Event Mesh (Default Plan) from your Subaccount, if applicable in your case.13. Click on Queues tab to create a new queue. Click on Create button.14. Give a name to the queue and click on Create-15. Go to SAP BTP Subaccount and create a Messaging Client to receive messages from Topics in S4H Public Cloud16. Create a space named “INTEGRATION_TOOLS”, or any other name of your choice. Use an existing space, if already available. Note that this step needs the “Integration Suite Event Mesh” entitlement to be added in Global account as mentioned in the Prerequisites section. 17. Click on Create to create an Instance of Event Mesh-Select Service as “SAP Integration Suite, Event Mesh” and other parameters as shown below. Take note of the Instance Name you provide, since this would be needed later during S4HANA Public Cloud configurations.Instance creation will show as In progress initially-Click on the Message Client “em-client-s4h” when it’s created-Click on Create under Service KeysGive it an appropriate name and click on CreateCopy this JSON content for use later in S4HC while creating the communication arrangement.19. Move over to S4HCloud system and open Communication Arrangements app. Click on New.Search for Scenario 0092, which is meant for Enterprise Eventing Integration.Give an appropriate name to the arrangement, assign user “CPI” (or any other comm user as suitable in your case) and paste the Service Key we created earlier and click on create.This will throw the below error message, which is expected. This error is thrown because we haven’t given any Topic namespace which will help S4HCloud to post this correctly to the Message Client we created in BTP when it is subscribed to a Topic in S4HCloud.Click on close.Add a namespace field with a value as em/client/s4h. This name is similar to the Message Client name. Just replace the “-” with “/”Add it back to the Service Key and click on Create.This is now displaying the new Communication Arrangement that has been created. You can now see the topic space added.20. Add these 2 apps – Enterprise Event Enablement (Event Monitor) and Enterprise Event Enablement (Configure Channel Binding) to your home screen in S4HC21. Go to Enterprise Event Enablement (Configure Channel Bindings)22. Click on Channel “EMIS_0092” which was generated in the previous step23. Click on Create under Outbound Topic Bindings24. Search for Events-/sap/s4/beh/businesspartner/v1/BusinessPartner/Changed/v1/sap/s4/beh/businesspartner/v1/BusinessPartner/Created/v1Click these one by one and click on Create   You can now see both the Topics are added to the outbound channel “EMIS_0092”.S4HC is now ready to send Business Partner – Create and Change events.25. Go back to the Queue in BTP to subscribe to these 2 TopicsClick on the queue Tab26. Go to Subscriptions tab and click on Create27. Paste the Topic names here one by one.Note that the topic subscription should have the format – namespace + /ce + /topic nameExample in our case-em/client/s4h + /ce + /sap/s4/beh/businesspartner/v1/BusinessPartner/Created/v1You need to manually paste these 2 Topicsem/client/s4h/ce/sap/s4/beh/businesspartner/v1/BusinessPartner/Changed/v1em/client/s4h/ce/sap/s4/beh/businesspartner/v1/BusinessPartner/Created/v1Do it for each of the Topics and click on CreateYou can now see the 2 Topics being subscribed to.28. Go to Overview tab of Event Mesh and click on the Message Client “em-client-s4h”This will open the Webhooks configuration screen. Click on Create.Use the below HTTP CPI iFlow Endpoint as the Webhooks URL-https://<TenantURL>/http/BPReplicationToSalesforceYou need to create a CPI iFlow with a HTTP Sender Channel, whose endpoint will then act as a Webhooks URL as shown above.Click on CreateThe webhooks should now forward any messages that appear in this queue to the iFlow meant for SAP to Salesforce BP sync.Below is a sample CPI iFlow that was used for this Demo. You can implement as per your requirement.Brief details of the CPI iFlow Steps-Business Events Message is received via a HTTP Sender Adapter.The payload format of the incoming event notification payload is as given in the below SAP API Business Accelerator link.https://api.sap.com/event/CE_BUSINESSPARTNEREVENTS/resource       2. The BP number needs to be extracted from this payload.       3. A call needs to be made to S4HC Business Partner OData API to fetch additional details for the Created or Changed Business Partner.       4. Map to the corresponding structure of Accounts object of Salesforce       5. Finally, send the payload to Salesforce API. This completes the configuration setup, enabling the integration to capture and forward any Business Partner updates to the downstream systems.As shown in the Solution Diagram earlier, you can create additional queues for other subscribers who are interested in receiving the same or other events and subscribe them to the required Topics of interest. Scaling Up with Advanced Event Mesh (AEM)-As your message size requirements grow, you can seamlessly transition to the more robust Advanced Event Mesh (AEM), which offers enhanced scalability and performance as compared to Integration Suite – Event Mesh (EMIS).Refer below materials-https://learning.sap.com/learning-journeys/discovering-event-driven-integration-with-sap-integration-suite-advanced-event-mesh/examining-sap-integration-suite-advanced-event-mesh_ce4073de-a466-4ac3-a2bc-4324b8b08b26https://help.sap.com/docs/sap-integration-suite/advanced-event-mesh/what-is-sap-integration-suite-advanced-event-mesh We have now reached the end of this blog post. I hope you found the content useful and that it helped clarify the setup and capabilities of SAP Integration Suite’s Event Mesh. Whether you’re just starting with event-driven architecture or exploring advanced options like Advanced Event Mesh (AEM), I’d love to hear your thoughts.If you have any questions, face issues during your setup or simply want to share your experiences, feel free to drop a comment below. Your feedback is always welcome and can also help others in the community facing similar challenges. References-SAP Community-https://community.sap.com/t5/technology-blog-posts-by-sap/meet-your-new-friend-emis-event-mesh-in-sap-integration-suite/ba-p/13731129Youtube-https://www.youtube.com/watch?v=tUIG34xT3oo&t=3587s   Read More Technology Blog Posts by Members articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author