In this article you will learn:
- How to configure Enterprise Event Enablement in S/4HANA system
- How to connect to Enterprise Messaging service from S/4HANA
What’s the scenario?
We want to notify our Node.js app in Cloud Platform that Sales Order was created. In order to achieve this we will enable Enterprise Events in our S4 and configure it this way that an event will be sent to Enterprise Messaging service after SO creation. This will be covered in this blog. Later we will create a queue, topic and webhook subscription in EM service to CPI. CPI will collect SO data via OData call and pass it to Node.js app. This part will be covered in part 2 of this blog. Last but not least, we will consume CPI message in our app and enable direct consumption from Enterprise Mesaging (part 3).
Let’s take a look at more friendly representation:
In the third part we will cover the below scenario:
Let’s move to the basics and enable and configure our events.
Enterprise events enablement
Actually this topic was quite well covered in other blogs and articles, but despite that I still couldn’t make it work (finally I did of course). I will refer to other materials and will not duplicate them here – you will have to read them and follow all the instructions there. I will guide you through all other things that were not mentioned.
So first of all – take a look at this great blog: https://blogs.sap.com/2019/09/16/sap-enterprise-messaging-for-s4hana-on-premises/.
In my case SSL Standard did not work when I uploaded certificates via STRUST. Try using an Anonymous profile.
Step 6 (Enterprise Messaging)
As you can see, I explicitly stated topic pattern but you can use “S42/*” as stated in the article.
Events for change document configuration (swec and swetypv)
It’s an old and well known transaction but it’s worth mentioning – S/4HANA events are based on this concept. So lets move to tcode SWEC and enable events for sales order creation:
VERKBELEG and BUS2032 will be our sales order, event CREATED and on change. If you want to add field restrictions – feel free to do so.
Now, let’s move to tcode SWETYPV and create a new entry:
Let’s create a Sales Order in VA01. After hitting save you should see a message in your queue:
It’s not there? Ha! This happend to me as well (one can go mad trying to figure out why). Take a look at this topic in answers.sap:
First, follow instructions by Tobias:
It worked for me but worked the unexpected way. At first, I wanted to create a scenario with Sales Order change event but it didn?t want to work. I went into a debug mode and found out table BEH_C_SUBSCRIPTN. Values are as presented:
114 is Sales Order and 21 is CREATED event. I tried to find out how to maintain this table and it occurred it is possible as of version 1909 from Fiori app. I haven’t found any other way to change it, if you know one let me know in the comments.
The best answer by Tobias gives a solution for the problem (at the bottom of the thread). Just remember to create user SAP_WFRT with proper authorizations before configuration in SWU3.
It may happen that you will get such message in SWUE:
Although my user SAP_WFRT had all authorizations it still did not work. You can try doing a workaround and assign destination explicitly in SWETYPV:
This should solve all problems and now you should be able to see message in your Enterprise Messaging service.
In this article, I (and other guys from the SAP Internet) showed you how to configure Enterprise Event Enablement in S/4HANA, how to configure events for change documents and how to troubleshoot potential errors. In part 2 we will create webhook to CPI, consume OData and move the message to Node.js app. See you there!