In this blog, I am going to show how to use ASAPIO Integration Add-on as an alternative to many coded approaches or AIF to create and send a custom event without writing a single line of code!
And for the fun of it, I ran against the clock and found out it took me only 15 minutes to define and send my event.
This approach only requires ASAPIO Integration Add-on with the Connector for SAP Advanced Event Mesh and an Advanced Event Mesh broker instance on SAP BTP.
The use case is to publish an event whenever a business partner is updated, e.g. to distribute master data across your system landscape. The event messages should contain all relevant data fields of the Business Partner ("Payload"). Alternatively, we could also send Simple Notification events (only Business Partner id), but this is rarely used in practice as it requires every event receiver to query the sender system again for the changed data.
In this example, we will send data from a SAP ECC system. For S/4HANA, the approach would work as well, with the difference that CDS views as data source would also be available.
We assume the Add-on is installed according to the installation documentation. The basic set-up includes the creation of the RFC destination, including the import of the SSL certificate, and the automated configuration via a BC-Set.
Another prerequisite is the set-up of a broker instance of SAP AEM. You can follow the official documentation from SAP or the Community Blogs, e.g. Create your first broker instance or Getting started with Advanced Event Mesh.
To start the configuration, the connection instance needs to be created. In Transaction SPRO > "ASAPIO Cloud Integrator - Connection and Replication Object Customizing", select "New Entry" and maintain an instance name of your choice (e.g. "ADV_EVENT_MESH"), the RFC Destination ("ACI_ADVANCED_EM"), the ISO Code ("UTF-8") and the Cloud Type ("SAP_AEM") :
In this example, we will create the payload (aka the ‘fields’ defining the Business Partner event record) from scratch. ASAPIO offers pre-built content as well, which you may check out and use as template and project accelerator.
First, the data to send as part of the event is defined with the low-code/no-code tooling. Therefore, open the ASAPIO Payload Designer (transaction /ASADEV/DESIGN) and click on "Create payload":
Specify a name, description, version, and status of the payload:
Then, click on "Join Builder" and add all desired tables that contain relevant payload:
For this demonstration, 3 tables are added to the payload and joined automatically. Then, the individual fields for the payload are selected in the "Fields" section of the Payload Designer. For this, double-click the table name in the Payload Designer and select all desired fields:
The business partner change event will now contain data from different tables sent as one payload to subscribers of the AEM topic:
In order to allow real-time, event-driven capturing of the event, a message type needs to be created. This is a simple task. Go to transaction WE81 and add a new entry as displayed in the screenshot (the message type name can be freely defined). We prefer to put a custom namespace as prefix:
After that, please activate the message type, in transaction BD50: add a new entry with the message type name and tick the checkbox to activate it:
Now is the time to finish the configuration: Go to the ASAPIO Integration Add-on (Transaction SPRO > "ASAPIO Cloud Integrator – Connection and Replication Object Customizing"), select connection "ADV_EVENT_MESH" and open the section "Outbound Objects". Here, add a new entry with the following properties:
Object: a speaking name for the event
Extraction Function Module: /ASADEV/ACI_GEN_PDVIEW_EXTRACT
Message Type: the message type name
Load Type: Incremental (this will send the events in real-time)
Trace: active (for development purposes, activate the tracing)
Response Function: /ASADEV/ACI_GEN_RH_SOLACE
Formatting Function: /ASADEV/ACI_GEN_VIEW_FORM_CB
Payload Name: the payload name defined earlier
The configuration looks like this:
Next, tell the framework when to send the event: whenever a business partner changes. For this, you can use BOR events in both SAP ECC and SAP S/4HANA. Link the event to the business partner (‘BUS1006’), event CHANGED in the "Event Linkage" section of the configuration (if you are unsure about which Object Type to use for the specific event, check transaction SWO3 for all standard SAP events that correspond with the business object of choice):
For AEM, the header attributes of the HTTP messages need to be specified as well. The header attributes are as follows:
SOLACE_CALL_METHOD = POST
SOLACE_CONT_TYPE = application/json
SOLACE_DELIV_MODE = Persistent
SOLACE_DMQ_ELIGIBLE = true
SOLACE_TIME_TO_LIVE = 2000
(The parameters are called Solace, because SAP AEM uses Solace PubSub+ as the broker technology underneath.) Specify them in the "Header Attributes" section:
Last but not least, one special treat: SAP AEM and Solace come with the Dynamic Topic feature, which means the topic a message should address can be created dynamically by specifying static and dynamic fields of the URL. In this case, four static values and two dynamic values are defined in the URL:
The event definition is now finished. As soon as someone now changes a business partner in SAP, our event is triggered and sent to our AEM broker.
To inspect the event transmission, open the ASAPIO Monitor in transaction /ASADEV/ACI_MONITOR. Furthermore, the AEM broker can be opened in parallel:
As one can see on the left side, a business partner change event is sent to the broker. The JSON payload of the data event can be inspected on the bottom left of the screen. As can be seen in the URL in the POST, the dynamic topic defined earlier with 4 static fields and two dynamic fields is used (/asapio-ci/businesspartner/change/V1 is the static part, /1/0000000889 the dynamic part). In AEM, use the "Try Me!" function to subscribe to the topic to obtain all events that are transmitted. And as you can see, once our event was raised in SAP, it was sent to AEM in real-time successfully.
So, in summary: without any custom coding and only by configuration, a standard trigger from SAP was used in the ASAPIO Integration Add-on to generate an event whenever a business partner changes. The event contains a custom payload taken from several tables and is then sent as a data event to SAP BTP AEM in real-time.
Let me know what you think and whether there are any questions about the scenario!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
13 | |
5 | |
4 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 |