Enterprise Architecture Blog Posts
Need a little more room to share your thoughts with the community? Post a blog in the SAP Enterprise Architecture group to explain the more complex topics.
cancel
Showing results for 
Search instead for 
Did you mean: 
Pratik_Ingawale
Participant
9,474

This blog will help to understand the event mesh concept from S/4 to BTP - Event Mesh.

Thank You Nilesh Puranik for the support and guidance provided.

Here is my First Blog. 😊

What is SAP Event Mesh?
Event mesh service is essentially an event that enables the flow of information between different applications and services in real-time.

SAP Event mesh enables a sending application to publish messages to a topic that directly sends the message to the queue to which it is bound. Events are associated with a topic to achieve the publish-subscribe model. Topics are managed through queue subscriptions.

 

Business Benefits of Event Mesh:

Real Time Communication: event mesh enables real-time, asynchronous communication between systems, allowing immediate reaction to the changes in business objects.

Scalability: Event mesh supports a high volume of events, making it suitable for large-scale integrations.

Resilience: The decoupling of event producers and consumers ensures that system failures do not affect the entire setup, thereby improving resilience.

Use case: Whenever a Warranty claim is approved in S/4 it should trigger event from S/4 to BTP event mesh.


Event Mesh Flow Chart

Pratik2228_0-1718881145824.png

Pre-Requisite:

  • Authorization to Configure Events in S/4 Hana.
  • BTP Service Event Mesh is Enabled / initial Setup completed.

             Part 1: Configuration of event mesh in S/4 Hana.

             Part 2: Steps to assign the custom event to trigger from S/4 Hana.

             Part 3: Creating Custom Events.

             Part 4: Subscribe to Event Mesh Service in BTP.

Setup Topic and Events channel in S/4 Hana.

Part 1:
Tcode: SPRO

Pratik2228_1-1718876215048.png

Click on "Create Via Service Key"

Pratik2228_2-1718876253685.png

Get Service Key details from instance created in BTP Subaccount.

Pratik2228_3-1718876288676.png

Now, Add the description, Protocol, Rfc name and OAuth Config Name, after which you can paste the service key json body.

Pratik2228_4-1718876313553.png

Click on save, and activate the channel.

Select the channel and Click on Outbound Bindings.

Pratik2228_5-1718876392565.png

Select the Topic name.

Pratik2228_6-1718876431808.png

In our case I have selected the Claim Accepted Topic.

Pratik2228_7-1718876459834.png

Part 2 : Steps to be done in S/4 Hana.

We will configure the S/4 Hana for triggering the events, for this we will be using a standard business object and event.

Goto tcode SWE2, Add Object type BUS2222 (Warranty Claim ) and event as CHANGED.

1. Refer the screen shot below for reference.

Pratik2228_8-1718876522156.png

2. Create a custom function module so that we can add in Receiver functional module.

Here we can add logic at what condition we need to trigger the event.

Read the container values and add the filter condition, in this example we are triggering warranty claims only when they are in approve status for eg : Y008.

This this example we have created Function module : YM2O_FM_CLAIM_RECEIVER

Pratik2228_9-1718876540684.png

Logic in FM for reference.    

ycl_bimpl_warrantyclaim_01=>raise_claimaccepted( it_events_claimsAccepted = VALUE #( ( pnguid = ls_pnwtyh-pnguid pncnt = ls_pnwtyh-pncnt %param = VALUE #( clmno = ls_pnwtyh-clmno )  ) ) ).

3. Activate the Event Linkage and “save”

Pratik2228_10-1718876965522.png

Part 3: Creating Custom Events.

Now we need to login to Eclipse.

  1. Create a define view Entity.
    Pratik2228_12-1718877411799.png
  2. We are using Warranty claim table with key as pnguid and pncnt.
    Pratik2228_13-1718877457273.png
  3. Create a Abstract Entity.
    Pratik2228_14-1718877485246.png

    We are using Claim no as abstract entity for input field.

    Pratik2228_15-1718877499506.png
  4. Create a Behavior definition
    a. Create a Behavior class add the Root entity created above.

    Pratik2228_16-1718877525968.png
  5. Event Binding

    Pratik2228_17-1718877600265.png
  6. S/4 Hana Class

    In behavior definition class that has been created with the method.

    Pratik2228_18-1718877622726.png

     

    Pratik2228_19-1718877627611.pngPratik2228_20-1718878313243.png

 Part 4 : Subscribe to Event Mesh Service in BTP.
         Pratik2228_21-1718878386911.png

         Select the Namespace.

Pratik_Ingawale_0-1719409411238.png

         Create a Queue.

Pratik_Ingawale_1-1719409611039.png        Assign the Custom topic created in S/4.

Pratik_Ingawale_2-1719409912782.png

 

Let me know if anything is missing.

Regards

Pratik Ratan Ingawale
Pratik Ingawale

7 Comments