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: 
dharamverma
Explorer
Introduction: In this blog, we will learn that how any consumer can consume events from S/4HANA cloud system via Event Mesh.

Event Mesh can receive S/4HANA cloud's event if the connectivity between SAP Event Mesh and the SAP S/4HANA Cloud tenant is established, we can achieve this by creating instance of S/4HANA Cloud extensibility service and Event Mesh in BTP.

Once we create service instance in a subaccount then a message client is created in Event Mesh and at the same time, event bus for this subaccount is also created. All service instances in a subaccount point to the same event bus

Once we create both instances in BTP, then there will be two message clients available in Event Mesh

1 S4P  (Message client for S/4HANA cloud extensibility service instance)

2 S4S (Message client for Event Mesh service instance)

****Message Client can be created with any name.

Let's understand the message clients and event flow with the help of below diagram.


S/4HANA cloud system will send event to a topic of S4P message client then a queue in S4S client will receive the same event because that queue is subscribed to same topic of S4P message client where S/4HANA has sent event.

Later, event can be sent to consumer via a webhook from queue.

Let's start setting up everything as per the above diagram.

Create Event Mesh Subscription (required for Event Mesh UI)

  1. Go to your BTP Cockpit global account and subaccount.

  2. Expand Services Instances and Subscriptions.

  3. Choose Create.

  4. Choose Event Mesh and the Standard service plan.

  5. Click on create and you will see the subscription on Event Mesh.


Add role Collection on Event Mesh to user.

Go to security->User on BTP and assign following role collection to required user.



 

Now if you go to the Event Mesh UI, you will not find any message client.


So, let's create a message client for S/4HANA cloud extensibility and Event Mesh

 

 

Add S/4HANA cloud system in BTP.

  1. Go to global account and add system under System Landscape.

  2. Give any name and select type as SAP S/4HANA Cloud and click add.

  3. Select the communication scenario group as below screenshot and get token which will be      used in S/4HANA cloud system.

  4. Now go to "Maintain Extension on BTP" tile under Communication management in S/4HANA Cloud system and click new to trigger registration from S/4HANA to BTP.

  5. Enter copied token and give some description.

  6. Wait for few seconds and you will see status as enabled.


 

Entitlement of S/4HANA cloud extensibility service

Now we can see the entitlement for S/4HANA cloud extensibility under S4(S4 System added in BTP) resources


 

Let's add services plan  for S/4HANA cloud extensibility service

  1. Go to Global account then Entitlements-> Entity assignments and click on add service plans.

  2. Select S/4HANA cloud extensibility as entitlement and messaging as plan

  3. Save it.


Create instance of S/4HANA cloud extensibility service

  1. Go to your BTP Cockpit global account and subaccount.

  2. Expand Services Instances and Subscriptions.

  3. Choose Create.

  4. Select "SAP S/4HANA Cloud Extensibility" as service and give any instance name.**The name must be the same as the one you have used when registering the SAP S/4HANA Cloud system during the pairing process.

  5. Click on next and put instance descriptor JSON.
    {
    "options": {
    "management": true,
    "messagingrest": true,
    "messaging": true
    },
    "rules": {
    "topicRules": {
    "inboundFilter": [
    "${namespace}/#"
    ]
    }
    },
    "emname": "S4P",
    "namespace": "sap/S4HANAOD/S4P"
    }


  6. Click on create and an instance of S/4HANA cloud extensibility will be created on BTP.                                        Go to BTP and open Event Mesh UI, you can see a message client of SAP S/4HANA Cloud Extensibility service instance.                                                                                                                                                                                                             The SAP S/4HANA Cloud Extensibility service instance is the client which creates the SAP S/4HANA Cloud integration and provides the credentials for the SAP S/4HANA Cloud system so that the SAP S/4HANA Cloud system can send events to that event bus. The purpose of this client is to send messages to a topic. It sends messages to the namespace which was configured while creating the service instance of S/4HANA Cloud Extensibility service.

  7.  As soon as instance of S/4HANA cloud extensibility is created, a communication arrangement of scenario SAP_COM_0092 will also be created in S/4HANA cloud.                                           . You can see arrangement name, Channel name and Topic Space are created with S4P(S/4HANA cloud extensibility instance name in BTP ) at the end.

  8. Go to Enterprise Event Enablement tile in S/4HANA cloud system and then go to Channel which is configured in communication channel and bind the event with it.                                         After this, S/4HANA cloud system is ready to send events.


S/4HANA cloud system will send events to event bus via S4P message client.

Now, we need a message client of Event Mesh Instance which will receive these events from S4P client.

 

Create Event Mesh Instance Using the Default Plan

  1. Go to your BTP cockpit global account and subaccount.

  2. Go to Instances and Subscriptions.

  3. Choose Create.

  4. Choose Event Mesh and the default service plan.

  5. Choose your Cloud Foundry space, enter an instance name, and choose Next.

  6. Specify parameters using a JSON file.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                              {
    "options": {
    "management": true,
    "messagingrest": true,
    "messaging": true
    },
    "rules": {
    "topicRules": {
    "subscribeFilter": [
    "${namespace}/*",
    "sap/S4HANAOD/S4P/*"
    ]
    },
    "queueRules": {
    "subscribeFilter": [
    "${namespace}/*"
    ]
    }
    },
    "version": "1.1.0",
    "emname": "S4HS",
    "namespace": "sap/S4HANAOD/S4S"
    }                                                                                                                                                                                                                            The SAP Event Mesh service instance is the client which receives the events. This service instance must have a different name and a different namespace than the ones configured for the SAP S/4HANA Cloud extensibility service instance. Since the purpose of this client is to receive messages from a different client the rules have to take care of that. So, for the SAP Event Mesh service instance, you need to configure the subscribe filter to the SAP S/4HANA Cloud Extensibility service instance.Here it defines that no publisher or producer can publish the message to either Topic or Queue, Only Queues can subscribe to a Topic with specific namespace(sap/S4HANAOD/S4P), here we can not create any topic, topic for subscription is available from other message client from the same Event Mesh

  7. Click on create.

  8. An instance of Event Mesh would be created on BTP and you can also see a message client on Event Mesh UI.


9.  Click on S4P client and then click on Events.

Here you will see the topic for the event which we have bounded with the channel in S/4HANA cloud system.


And you can download the schema of any event by clicking on it.


10. Open S4S client and create a new Queue in Receiver Client S4S.


 

11.  Subscribe Queue of S4S client to Topic of S4P client.


 

12. Create a webhook for a consumer of this event.


Give the queue name of where event will come from Topic and give consumer's URL and click on create.

Now all set for an event to flow from S/4HANA cloud system to Consumer via Event Mesh.

Conclusion: After reading this blog, you have learnt to enable events from S/4HANA cloud system to Event Mesh

 

Click here to understand " How to configure Queue/Webhook in Event Mesh"

 

 

 

 
4 Comments
Labels in this area