Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dipan_Ghosh
Participant

Introduction:


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.


Prerequisites:



  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.


Testing:


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.


 

Conclusion:


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.
8 Comments
Labels in this area