Technical Articles
SAP Enterprise Messaging for SAP ERP: HowTo-Guide (Part 2 – First use case)
Since July the SAP NetWeaver add-on for event enablement is available to customers as anounced here. The Add-On enables SAP Netweaver systems to participate in an event driven architecture that is using SAP Enterprise Messaging.
This is part 2 in the blog series on the new event enablement add-on. In part 1 my colleague Florian Farr showed you already how to setup the connectivity between SAP ERP and SAP Enterprise Messaging.
In this blog post I will show you how to configure a notification event for Sales Order changes.
You can use these steps to configure a notification event for the business object of your choice or you follow along with the example for Sales Orders.
Step 1: Create Message Type
For our example we create the message type Z_SALES_ORDER_CHANGE
:
New Message Type
Important:
Be sure to not reuse existing message types as they will be used for change pointers that get consumed by the first subsriber. For the purposes of sending events each event must have its own message type.
To make use of the message type it also has to be activated. In transaction SPRO
you go to “Integration with Other SAP Components → SAP NetWeaver AddOn for Event Enablement → ALE Delta Cusotmizing → Activate Change Pointers for Message Types” or you can use transaction BD50
directly:
Activate Change Pointers
Step 2: Customize outbound object
Next step is to configure a “Outbound Object”. For this you go to “Integration with Other SAP Components → SAP NetWeaver AddOn for Event Enablement → ACI: Connection Customizing File Transfer”.
There you select the cloud connection you created in part 1, go to section “Outbound Objects” and add a new entry:
Outbound Object
Give the object a descriptive name, enter the message type created in step 1 and enter the suggested function modules /ASADEV/ACI_SIMPLE_NOTIFY
and /ASADEV/ACI_SAP_EM_CLOUDEV_FM
.
Now add details in the “Header Attributes” section for the individual event:
Header Attributes for the Event
Important:
Make sure that the topic specified under SAP_EM_TOPIC
matches the namespace of your Enterprise Messaging instance.
Step 3: Establish Business Object Event Linkage
Now we want to link the customizing we did so far to an actual Business Object Event so that we get notified when a Sales Order is changed in our system.
To create this link you go to transaction SWE2
and create a new entry. Here you link the business object event to a function module using the create message type as the receiver type.
Enter /ASADEV/ACI_EVENTS_SYNCH
as the receiver function module and don’t forget to activate the linkage:
Business Object Event Linkage
Step 4: Test the event
In order to test the event you can now go to transaction VA02
, change a Sales Order and save it.
This now triggers the business event and through the event linkage also sends the event to Enterprise Messaging.
To see if the event was correctly triggered you can go to transaction /ASADEV/ACI_MONITOR
or to SLG1
and verify the logs:
Monitoring and Logging
In Enterprise Messaging you can also create a queue subscribing to the selected topic in order to verify that it correctly reaches the Enterprise Messaging or of course directly consume the events with another application in your SAP Cloud Platform.
Conclusion
With the 4 steps described you can easily configure a notification event in your SAP ERP system to be sent out to your SAP Enterprise Messaging instance.
Please let me know which objects you connected, what your use cases are and which further topics regarding the usage of the new add-on are most interesting to you.
Thanks, Martin! I linked this blog post with Part 1
Thanks Martin, very good explained.
I have already installed the add-on in our ERP sandbox and it's all configured based on the help from SAP (https://help.sap.com/viewer/e966e6c0e61443ebaa0270a4bae4b363/1.0/en-US/3eba827c531344eb879d8e35022d90ba.html) and from the blog from Florian Farr .
Then I've followed the example for Article Create explained in the help.sap and now I have replicated your example for the Sale Order Creation. But my problem is that I don't see any event after that in the monitor neither in the logs.
Is there any extra config that I have to do in order to create these events?
For the Article example I was able to see some entries in the table BDCP2 but in fact nothing happens in Enterprise messaging, and i don't see any message in the /ASADEV/ACI_MONITOR.
For the Order example I don't see any entry in the BDCP2.
I see in the spro these 2 options but as they are not mentioned here neither in the SAP help, i'm not sure if something is missing in my side:
spro asapio
In case an extra configuration is needed to produce the events, could you please share it ? It would help a lot.
Thanks a lot for your fantastic blog.
Best Regards
Hi Carlos,
can you please check in "Activate Change Pointers - Generally" if this is active?
If this is already set then the next step is to activate and check if the event trace shows the linkage you configured (transactions SWELS and SWEL).
If you have an entry in BDCP2 I would assume the event trace shows that the business event triggered but perhaps it will show an error in the details.
Please also check the logs in SLG1 for object /ASADEV/AMR_LOG.
Best regards
Hi Martin,
Thanks for your answer, very helpful.
The trace was active but with restrictions and I was not able to see anything. After removing the restriction the light come to me.
Another problem that I've founded was that the entries in the Transactional RFC monitor were recorded but not processed. I've processed manually and after that everything start working.
So now I'm in a better situation, I see my events in the monitor:
So I was checking and I've found a problem when I try to setup the Cloud shared Secret:
So I don't know if you know why this is happening. Another question is regarding the ASAPIO monitor, when I try to reprocess a message I got the following error:
Do you know where I can create this Variant?
I'm sorry to bombard you with questions, but I don't find many documentation regarding this topic and I feel a bit alone in the dark 🙂
Thanks again
Best regards
Hi Carlos,
to investigate the techincal issues regarding the secure store please open an OSS incident with SAP for component OPU-ASA-EE. To me this seems to be some issue when installing the add on.
Regarding the calls being parked instead of executed directly please check if the basic workflow customizing has been done in your system (transaction SWU3).
The re-processing in the monitor currently does not work for calls like this.
There is a transaction /ASADEV/ACI with which you can plan a background job to pick up failed calls. This will have a variant and with that you can re-process the calls.
Best regards,
Martin
Hello Martin,
Is it possible to re-trigger the Events from the monitoring transaction ( /ASADEV/ACI_MONITOR ) with the buttons. "Process the selected Variant" " process the selection variant via selection screen".
My requirement is : we sent an event to the a third party system, Event has been processed successfully. however they have some issue and we need to re-trigger the event. How can i do this ?
Regards
Hi Metin,
there is a possibility to reset the change pointers the framework uses as indicator if the event has been sent.
For this you can go to transaction /ASADEV/SCI_CP_RESET, select your message type and for which date range to reset the change pointers.
After you did this you can then trigger the re-processing via transaction /ASADEV/ACI where you can configure your cloud connection and outbound object and trigger the framework to send the event again.
We are also working on enabling re-sending from the monitor transaction for the next release.
Kind Regards
Your blogs made me finally start getting into the topic. Thank you very much.
Are you guys planning a third blog with more advanced topics like message mapping, own FMs, BAdis, ...?
I would also like to know more about the more advanced possibilities. For example we would like to distinguish on business partners based on bptype (customer, client, contact person etc.), and send them to different topics. I assume that we should implement a check function, but I would love to see an example.
Hi Martin Schöffler,
I have a question about the configuration of the Event Enablement Add-On. What is Field Mapping all about? Is there a documentation for this? I have not found a tutorial on the SAP help pages or somewhere else.
Kind Regards
Hi Martin Schöffler,
We installed this add-on succesfully on our system. I followed the tutorial and we were also able to send a custom event based on the Sales Order from our S4 Retail system.
However I can't figure out how we can now go further with the changepointer principle, basically what we really need. In your example / first use case we make a custom changetype, but we do not assign changed fields / tables to it. So in my opinion this still make use of the standard business object BUS2032.
As an example I want to create a custom event when a certain field in the product master changes (without making use of the standard Business Event that is available for products).
I created a custom changepointer, configured a key field to it and added (all article) business objects of article master to it.
Changepointers are created:
But in the ASADEV/ACI_MONITOR no messages are created.
How can we handle this?
Thanks in advance.
Regards,
Robin Kleingeld
Hi Martin Schöffler,,
Is it possible to link EM for custom object? I have a custom transaction used to update a custom table. User request is to notify to EM when a new record is updated.
This custom table is then not linked to BO.
I suppose that in the custom transaction i have to trigger a particular event that i can configure in SWE2?
Please suggest me.
Thanks.
@Martin Schöffler,
Nice blog! Since we're basically using iDoc message types and change pointers here - is it possible to reduce the change pointers written for a message type in BD52 as we usually do with iDocs? Since "SalesOrderChanged" is a pretty broad event, it would be nice to limit it and instead have multiple events for it, e.g "Sales Order Delivery Block changed", "Sales Order delivery status changed"
Special events like this can be configured as described here by Benedikt Sprung :
https://blogs.sap.com/2022/03/16/custom-events-in-sap-event-mesh.-step-by-step-part-1-create-a-custom-event/
The field restrictions match this kind of use case you get from BD52.
Field Mapping with STO order not working
Hi Martin,
We have configured the setup for stock transfer order (STO) as per your given blog for order event mesh process. We are unable to process field mapping for required field data. We want to have two scenarios, with all mapped field data & another with filtered restricted data.
Need your guidance to mapping out table / multipe tables and required filtering data from SAP.
Regards,
Rajesh V.
Hello,
In SWE2 are you adding the custom message type in the receiver type?
Regards,
Arnab.