You need a user with access to maintain communication arrangement and maintain business user.
Steps
Intro
This tutorial was written for SAP BTP ABAP Environment. However, you should also be able to use it in SAP S/4HANA Cloud Environment in the same way.
Always replace #### with your initials or group number.
Step 1Overview
—
An event is a data record expressing a significant change in state and its surrounding context. For example, a change of a business object such as business partner, can be indicated by raising a business event. Events will be developed and configured and going to be sent to the event mesh service in the cloud. Since SAP Event Mesh is responsible for message delivery, senders do not need to know which applications, services or systems will receive what data. An interested party having subscribed to this event, can consume, and process it. Event consumption works in ABAP platform, in steampunk. In the event consumption at runtime, you have two main parts which are the event providers and the event consumer system, and both are connected via message broker in our case this would be SAP Event Mesh.
Overview
Step 2Communication Arrangement for SAP event mesh instance in the cloud system
+
Here you will create a communication arrangement to connect your S/4 system with the SAP Event Mesh. So if you create later a new business partner in this S/4 system and by means of a SAP Event Mesh instance you can consume it in a SAP BTP ABAP environment system. To publish an event in the Cloud, you need first to Create a communication arrangement and then Create Outbound Bindings for the created channel.
Login to the cloud system.
login
Navigate to Communication Management and click Communication Arrangement.
arrangement
Click New to create a communication arrangement.
new
new
Choose sap_com_0092 as Scenario and copy the service key of your event mesh instance under Service Key.
You need to create a Communication User. Click New and enter a User Name, Description and Propose Password. Copy the generated password and save it for later. Click Create.
user
user
Now you need to change the Arrangement Name to Z_EVENT_0092_#### and replace #### with your initials or group number. This Arrangement Name will also be the name of the channel which is used later to send events.
Click Create communication arrangement.
name
Open your new created communication arrangement and check the details.
details
Step 3Create Outbound Bindings and generate Metadata
+
Now you need to choose your outbound topic like create, update, etc. And afterwards you can download the created .json file. This specification file contains all metadata of the event like how the payload looks like, what kind of types are there, etc.
Search for Enterprise Event Enablement App and open it.
app
Click Go to open a list of channels and choose your channel in this list.
channel
Now you need to add the outbound topic you are interested in to this channel:
Click Create
create
On the next page click Topic value help
create
In this popup search for sap/s4/beh/businesspartner/v1/BusinessPartner/Created/* and choose sap/s4/beh/businesspartner/v1/BusinessPartner/Created/*
create
Click Create
create
Go back to your channel and scroll down to Event Metadata and save the metadata as a .json file for further usage. This specification file contains all metadata of the event.
create
If the metadata is empty please reload the page with F5 and try again.
Step 4Create Event Consumption Model
+
Here you will create an Event Consumption Model with the .json file that you downloaded in last step.
Open ADT and open your SAP BTP ABAP environment system.
Create a new ABAP Package if you have not one. Please be sure if your package name is with Z like
Name: ZEVENT_CONSUMPTION_####
Description: event consumption
new
Right-click your package and choose New > Other ABAP Repository Object > Business Services > Event Consumption Model and click Next to launch the creation wizard.
new
new
Fill the fields and upload the .json file you saved before into the new event consumption ADT wizard. This will then automatically generate all that you need in this event consumption model, like the event handler custom code, authorization defaults values and inbound service.
Name: will be created with the Prefix and Identifier
Description: event consumption model
Namespace/ Prefix/ Identifier : Zand EVENT####
Event specification File: .json file
click Next.
event
Select all the event types that you would like to consume in your business application and click Next.
event type
Click Next by Define Consumer Artifacts
define
In ABAP Artifact Generation List you need to copy the Inbound Service name for later usage. Click Next.
generate
Select a Transport Request and click Finish.
transport
In created event consumption model you can see the selected Event Types that are assigned because of your .json file.
types
Save and activate your event consumption model.
Step 5Create Communication Scenario for Event Consumption Model
+
In this section you will create a communication scenario for the previously generated Event Consumption Model and you will get explanation of additional steps needed to use it later for the event consumption. Eventually, this communication scenario is used in the productive system to create a communication arrangement with the previously generated Event Consumption Model. Moreover, a sap_com_0092 communication arrangement will be required in the productive system which denotes the connection from the productive system to the event mesh instance in the SAP BTP ABAP environment system. These two scenarios combined will then enable the event consumption with the generated Event Consumption Model.
Right-click your package and choose New > Other ABAP Repository Object > Cloud Communication Management > Communication Scenario and click Next.
new
scenario
Enter the following name and description:
Name:Z_EVENT_SCENARIO_####
Description: event consupmtion scenario ####
and click Next.
scenario
Select a transport request and click Next. The newly created Communication Scenario opens automatically.
scenario
In the Communication Scenario under General:
as Communication Scenario Type choose Customer Managed,
as Allowed Instances you can choose what suits you best for the given Event Consumption Model.
Click the Inbound tab of the Communication Scenario. In the Inbound configuration click Add… under Inbound Services.
inbound
In the pop-up, insert the previously generate inbound service (you copied the inbound service name in step 4-7) of the Event Consumption Model under Inbound Service ID and click Finish.
event
Save the communication scenario by pressing Ctrl + S.
To test the created communication scenario with the generated Event Consumption Model, you must click Publish Locally in the communication scenario.
Publish
Step 6Create database table for handler method
+
In this step, you can create a DB table and save the business partner Ids in this DB table. With this you can consume the event which is created in a S/4 system. Creating a DB table in this tutorial is just to help you to save and check your created Ids.
Right-click your package and choose New > Other ABAP Repository Object > Database Table and click Next
new
database
Enter the following name and description:
Name:ZTABLE_####
Description: Database table
database
click Next, select a Transport Request and click Finish .
Define the table with this code and replace all #### with your number:
In the consumer extension class, the event processing logic can be implemented. In the generated class, you can find for each event type of the Event Consumption Model a respective handle event method. In each method, the corresponding event type and the typed business data for this event can be found. The latter is commented out so that you can implement your own logic.
Navigate to Business Service > Event Consumption models > ZEVENT#### > Classes > ZCL_EVENT#### which is generated (or you can navigate to the Source Code Library > ZCL_EVENT####). Here you can see the create Method.
class
class
Remove comment from these lines:
Code
DATA ls_business_data TYPE STRUCTURE FOR HIERARCHY Z_BusinessPartner_Created_v1.
ls_business_data = io_event->get_business_data( ).
You need to copy the code below and replace it in your method. Replace all #### with your number:
ZCL_EVENT####
DATA ls_business_data TYPE STRUCTURE FOR HIERARCHY Z_BusinessPartner_Created_v1.
DATA wa TYPE ztable_####.
ls_business_data = io_event->get_business_data( ).
wa-payload = ls_business_data-BusinessPartner.
DATA(sydatum) = cl_abap_context_info=>get_system_date( ).
DATA(sytime) = cl_abap_context_info=>get_system_time( ).
wa-recorddate = sydatum.
wa-recordtime = sytime.
DELETE FROM ztable_####
WHERE recorddate < @sydatum.
INSERT ztable_#### FROM @wa.
Your code will look like the following:
class
You can raise an exception whenever there is an issue. This will imply that the event processing has failed and therefore set the event status to failed. To see the exception, open Window > Show View > Other search for Feed Reader. Here you can see a message if an issue is raised.class
Step 8Communication Arrangement for SAP Event Mesh instance in the SAP BTP ABAP environment system
+
Then in Fiori launchpad of your SAP BTP ABAP environment system you first need to build a communication arrangement with sap_com_0092 scenario and the same service key instance you used to build your communication arrangement in the cloud system.
To open the Fiori launchpad right-click your project in ADT and navigate to Properties
Properties
Click Service URL to open the dashboard of this system.
dashboard
Navigate to Communication Arrangement and click New to create a communication arrangement.
Choose sap_com_0092 as Scenario and copy the service key of your event mesh instance under Service Key. You need to create a Communication User. Click New and enter a User Name, Description and Propose Password. Copy the generated password and save it for later. Click Create.
Now you need to change the Arrangement Name to ZPM_EVT_0092_#### and replace #### with your initials or group number.
Click Create communication arrangement.
communication
Step 9Communication Arrangement for event consumption model in the SAP BTP ABAP environment system
+
The connection between your BTP system and event mesh instance is done, now you need to create another communication arrangement with the scenario you already published in ADT:
Navigate to Communication Arrangement, click New.
new
Choose your created scenario and click Create.
create
In the communication arrangement you need to define a communication system. Click New and enter a System ID and System Name like ZEVENT_#### and click Create.
new
name
Communication system will be opened. Here scroll down to the Event Mesh and enable it. Open the value help and in the popup search for the communication arrangement name you created in the previous step:
mesh
com
Fill out the inbound username with the user name created in the last step and click OK.
user
create
Under General click the Inbound Only option and click Save.
save
In communication arrangement click Save.
save
Step 10Maintain Subscription
+
Now you need to choose a subscription in your channel to specify in which queue you should get the event message.
In the Fiori launchpad search for Enterprise Event Enablement App and open it.
Enterprise
Click Go to see a list of channels and choose your channel.
channel
You need to check if the inbound topic from your event consumption model is added successfully in to this channel:
Reload the page until you can see the inbound topic.
channel
Navigate to Subscription and click Create and subscribe to the queue you already created for your event mesh instance from which you should get the event message.
To test your eventing process you need to create a business partner and check if the created ID will appear in the table.
Open your S/4 Cloud system and navigate to Maintain Business Partner.
business
Click Person to create a new business partner.
create
Enter First Name and Last Name like following
First Name:business
Last Name: partner ####
replace #### with your number and press Save.
save
Check the created Business Partner Id
partner id
Back to SAP BTP ABAP environment system in ADT and open your database table ZTABLE_#### and run the table with F8. You can find your created business Id in this table.
Share feedback on this tutorial or join the conversation in SAP Community.
Submit detailed feedbackDiscuss in Community
Steps
Step 1 of 12
1. Overview2. Communication Arrangement for SAP event mesh instance in the cloud system3. Create Outbound Bindings and generate Metadata4. Create Event Consumption Model5. Create Communication Scenario for Event Consumption Model6. Create database table for handler method7. Define handle event methods8. Communication Arrangement for SAP Event Mesh instance in the SAP BTP ABAP environment system9. Communication Arrangement for event consumption model in the SAP BTP ABAP environment system10. Maintain Subscription11. Create business partner12. Test yourself
Joule
AI Notice
Joule is an AI assistant. Generative AI may produce inaccurate, incomplete, or biased information. Always verify important details before acting on them.
Conversations are sent to SAP-hosted large language models for processing. Do not include personal data, credentials, or confidential information in your messages.
Joule's responses are based on the SAP tutorial catalog and may not reflect the latest product changes. For authoritative guidance, consult the linked tutorials and official SAP documentation.