Skip to Content
Technical Articles
Author's profile photo Benedikt Sprung

Custom Events in SAP Event Mesh. Step-by-Step (Part 1 – Create a Custom Event)


In this step-by-step guide, we will see:

  • How to create a Subtype of a Business Object
  • How to create Events for the Business Object
  • How to establish the Event Linkage for Change Documents
  • Finally, how we can make use of it in our SAP NetWeaver add-on for event enablement


Part 1: We will create a custom Event Linkage for a Material Change using transaction SWO1 and SWEC.

Part 2: Now we can make use of it in our SAP NetWeaver add-on for event enablement.


Introduction to Part 1

In this Blog Post we will see, how to create a custom event. This is necessary if the Business Object does not provide us with the event, that we want to be able to trigger. A common example is a change of a material. The “Change Event” is not provided by default. Therefore, we will create a subtype including the Change Event using the following 4 steps.


Step 1: Find your Business Object

In our case, we want to be able to trigger a Material Change, which is the Business Object BUS1001.

Go to transaction SWO1–> “Business Object Repository”.


Figure 1 Navigate to the Business Object Repository

There you will be able to find the Business Object under:

Logistics – General –> Logistics Basic Data –> Material Master –> BUS1001

Doublecklick BUS1001 in order to see the events that are available by default.

As we can see that there is no Change Event available by default.


Figure 2 Check the events of BUS1001 in SWO1


Step 2: Create a subtype of BUS1001

Go to Transaction SWO1 and create a subtype of BUS1001. Maintain the details as shown in Figure 3.


Figure 3 Creating a subtype in transaction SWO1


Step 3: Create a Change Event

Now we can click on the “Change” button to have a look at our newly created ZBUS1001 Object. It is now a copy of BUS1001 and we will add our change event here.

Mark “Events” and click “Create”. Maintain popup for your new Material Change Event.


Figure 4 Create your new Event



Figure 5 Now your subtype of BUS1001 should look like this


Place your curser on the event and release it:

Edit -> Change Release Status -> Object Type -> To implemented.
Edit -> Change Release Status -> Object Type Component -> To implemented.                                    Edit -> Change Release Status -> Object Type -> To released.
Edit -> Change Release Status -> Object Type Component -> To released.

Click the generate button.


Figure 6 Release it and generate it afterwards


Step 4: Event Linkage for Change Documents

Now that we created our new ZBUS1001 Object Type, we want to link it to a change event in the System.

Go to transaction SWEC New Entries.

Add your Object Type that you just generated in the previous step and click safe.

Note: With the Function Module /ASADEV/ACI_CPIDENT_TRANSFER we can provide the key of the change document and pass it to the SAP Netweaver Add-on for event enablement to be used in the data extraction.


Figure 7 Create the Event Linkage for Change Documents


Optional Step 5: Field Restrictions

By following the first 4 steps above we created an Event that will be triggered with any change that is being done on a material.

Sometimes we don’t want to get notified of every change that is happening on a Material. Therefore, we can use Field Restrictions and specify the Events that we want to be able to see.

This is also done in Transaction SWEC. Choose the Object Type that we created in Step 4 and click on Field Restrictions. In this example, we are only interested to be notified, when a Material Group is changed or the Material gets locked. Now we don’t get notified by any other Change on a Material. See the configurations in Figure 8.


Figure 8 Field Restrictions in SWEC


We extended a subtype of the Business Object BUS1001 by a material change with the following actions:

  • Create subtype BO in SWO1
  • Create an event for our subtype in SWO1
  • Link a change document to the BO event in SWEC

Now we have everything prepared to make use of it in the SAP NetWeaver add-on for event enablement.

In Part 2 we will catch a Material Change and push it in real-time into the cloud.

Please provide feedback or thoughts in the comment section.
There is a Q&A regarding the SAP Event Mesh.
You can also follow the tags and profiles for more upcoming articles.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Rajesh Chiplunkar
      Rajesh Chiplunkar

      Thanks for sharing the post. We were able successfully configure a custom event using the clear instructions provided by you. We observed that field restrictions work for the fields which are captured in the change log. However, as per our requirement we want to restrict the event creation only for a specific set of documents i.e. sales documents of a particular order type or Sales org.

      We tried to configure the same by giving old and new field values of sales org. as same. However, the change log does not capture these values unless there is a real change and hence are trigger fails.

      Can you please provide feedback on how we can achieve this ?

      Thanks in advance.

      Author's profile photo Martin Schöffler
      Martin Schöffler

      Hi Rajesh,

      you can also do filtering using a check FM in the event linkage. There you can write checks in custom ABAP logic to decide if the event should be fired or not.

      There is also a pre-delivered one in the framework: /ASADEV/ACI_EVENTS_CHECK

      It checks against filter values that are defined as header attributes on the outbound objects in the following notation:


      Where <attribute_name> is the name of an attribute of the Business Object. As value you give the value that restricts the event.

      Kind regards,


      Author's profile photo kuldeep tiwari
      kuldeep tiwari

      Hello Benedikt,

      We have created custom change event for material master in S4 HANA and it is working as expected.

      Whenever the field restriction is applied on that event, hence the event does not emit.

      Although, our requirement is specific that the event needs to be triggered for material group A002 from S4 system.

      Kindly suggest the steps to attain the event.

      Author's profile photo Benedikt Sprung
      Benedikt Sprung
      Blog Post Author

      Hello Kuldeep,

      with the field restrictions you are using the event will only be triggered when the MATKL changes from A001 to A002.

      If you only want to trigger materials for MATKL A002 you could use a User Exit or a BAdI, check the MATKL and CALL FUNCTION 'SWE_EVENT_CREATE' if it's A002.

      Kind regards


      Author's profile photo Per Åge Themte
      Per Åge Themte


      Are the ASADEV/ package generally available in any S/4 system or does it require payed addons?

      Author's profile photo Benedikt Sprung
      Benedikt Sprung
      Blog Post Author


      to be able to download the add-on you need an active subscription of the Enterprise Messaging service. The Add-on component is available at the Software Center.

      Author's profile photo Per Åge Themte
      Per Åge Themte

      Benedikt Sprung Hi!,

      I've just installed the add-on to our new S/4 instance and followed a few blogs. I managed to get the event to fire when using BO BUS2032 (sales order), but using a subtype of either 2032 og 1001 does not do anything. I've followed the guide above with the same data, but no events can be found in the monitor. Can you please provide some useful hints on how to troubleshoot this? Are the release status on the new event important? Cause your guide tells me to component to released, but the type to implemented. When trying that, SAP complaints that the lower level component can have an higher status than the type. I did release both, but still no event was triggered (empty field restrictions..)

      Please advice 🙂

      Author's profile photo Benedikt Sprung
      Benedikt Sprung
      Blog Post Author


      great to hear that you have succesfully configurated your first events.

      Did you exchange the subtype with the standard bo type in the "Event Linkage"?

      To troubleshoot it, you can check in transaction SWEL if the event is visible there. (activate it with transaction SWELS).

      Another way to simulate the event is in transaction SWUE. Use your subtype there.

      Kind regards,


      Author's profile photo Per Åge Themte
      Per Åge Themte

      Well, I added it. But do I need to replace it for the provided one for material?

      Author's profile photo Benedikt Sprung
      Benedikt Sprung
      Blog Post Author

      Yes you can replace it. Your ZBUS1001 also contains the events from BUS1001.