RAP Business Events with Advanced Event Mesh [6]: Consuming a remote event

Estimated read time 5 min read

This series of blogs intends to show in a step-by-step way the different possibilities to use RAP Business Events with Advanced Event Mesh.

 

Overview

Besides sending events to the Advanced Event Mesh it is also possible to receive events from it. To demonstrate that we will configure the system to receive the Business Partner Changed event that is send to the AEM as per the first blog. For that we’ll be creating a consumption model in ABAP Development Tools, configure an inbound binding and configure a subscription. An exact tutorial can also be found here.

 

Create a consumption model

To consume an event, start of by downloading the event specification of the Business Partner Events. For each documented event there is a dedicated event specification file available which describes the events of the business object. Download the JSON file from the Business Accelerator Hub.

Create a new ABAP Package “ZEVENT_CONSUMPTION”. Within that package create a new Event Consumption Model. For the consumption model a prefix and an identifier have to be used. You can use “Z” as prefix and “BPEvents” for the identifier.

On the next screen the different event types that are listed within the event specification can be selected to be included within the event consumption model. Each selected event type gets its own dedicated event handler method to react to an event of that type.

After creating the consumption model, don’t forget to active it.

 

Create an inbound binding and subscription

With the event consumption model created we can go into SAP GUI and configure the inbound binding. For that go into transaction /IWXBE/INBOUND_CFG, select the channel to your Advanced Event Mesh and create a new topic binding.

Select the topic of the event you want to consume.

On the next screen select your consumer (here ZBPEVENTS) and create a new destination. In the “Create Destination” dialog enter your user and click save.

After finishing the creation of the inbound binding, the subscription can be created. For that go to transaction “/IWXBE/SUBSCRIPTION” and click “Create new subscription”. Give the name of the queue you want to consume the events from and select save.

 

Testing

To test whether the event consumption has been successfully configured, first check if there are any consumers listed for the queue.

With the subscription being configured events that are send to the AEM queue should be consumed by the S/4 system. To test this, trigger an event to be send to the queue. It should then directly be consumed by the system. To view each consumed event, go to the event monitor (transaction /IWXBE/EVENT_MONITOR). There you can select the channel to your AEM and “Inbound Events” list all inbound events configured.

 

 

 

​ This series of blogs intends to show in a step-by-step way the different possibilities to use RAP Business Events with Advanced Event Mesh. OverviewBesides sending events to the Advanced Event Mesh it is also possible to receive events from it. To demonstrate that we will configure the system to receive the Business Partner Changed event that is send to the AEM as per the first blog. For that we’ll be creating a consumption model in ABAP Development Tools, configure an inbound binding and configure a subscription. An exact tutorial can also be found here. Create a consumption modelTo consume an event, start of by downloading the event specification of the Business Partner Events. For each documented event there is a dedicated event specification file available which describes the events of the business object. Download the JSON file from the Business Accelerator Hub.Create a new ABAP Package “ZEVENT_CONSUMPTION”. Within that package create a new Event Consumption Model. For the consumption model a prefix and an identifier have to be used. You can use “Z” as prefix and “BPEvents” for the identifier.On the next screen the different event types that are listed within the event specification can be selected to be included within the event consumption model. Each selected event type gets its own dedicated event handler method to react to an event of that type.After creating the consumption model, don’t forget to active it. Create an inbound binding and subscriptionWith the event consumption model created we can go into SAP GUI and configure the inbound binding. For that go into transaction /IWXBE/INBOUND_CFG, select the channel to your Advanced Event Mesh and create a new topic binding.Select the topic of the event you want to consume.On the next screen select your consumer (here ZBPEVENTS) and create a new destination. In the “Create Destination” dialog enter your user and click save.After finishing the creation of the inbound binding, the subscription can be created. For that go to transaction “/IWXBE/SUBSCRIPTION” and click “Create new subscription”. Give the name of the queue you want to consume the events from and select save. TestingTo test whether the event consumption has been successfully configured, first check if there are any consumers listed for the queue.With the subscription being configured events that are send to the AEM queue should be consumed by the S/4 system. To test this, trigger an event to be send to the queue. It should then directly be consumed by the system. To view each consumed event, go to the event monitor (transaction /IWXBE/EVENT_MONITOR). There you can select the channel to your AEM and “Inbound Events” list all inbound events configured.     Read More Technology Blogs by SAP articles 

#SAP

#SAPTechnologyblog

You May Also Like

More From Author