This series of blogs intends to show in a step-by-step way the different possibilities to use RAP Business Events with Advanced Event Mesh.
Overview
In this first blog, we’re going over the basic integration to connect Advanced Event Mesh to S/4HANA On Premise 2023. We are going over the required setup to connect the two and configuration to send standard business events, in this specific case the business partner changed event, from the S/4HANA system the the Advanced Event Mesh.
Connect Advanced Event Mesh to S/4HANA On Premise
To connect the Advanced Event Mesh to the S/4HANA On Premise system two destinations have to be created within the transaction SM59. One for the AEM broker (mr-connection-*.messaging.solace.cloud) and one for the validation service (em-pubsub-broker). While the destination for the AEM broker has to be setup manually, the destination for the validation service can be setup automatically via the service key from the BTP.
For the AEM Broker destination a host URL and port is required. These can be taken from the AEM UI. Go to “Cluster Manager” and select the “Connect” tab. Next select “View by Protocol”, click on the protocol “AMQP” and select one of the client libraries to view the host URI.
Next open transaction SM59 and create a new destination with type G. Enter the host and port copied from the AEM UI. While the relevant protocol is AMQP, the host URL in S/4 needs to have the protocol manually adjusted to “tcps://”. The destination should therefor look as follows:
Next select the tab “Logon & Security” and set SSL to Active.
The Enterprise Event Enablement integration within S/4HANA uses Client Certificate Authentication to connect to the AEM. Therefore the next step is to export the necessary certificates from S/4HANA and import them to the AEM.
For that first remember the SSL Client PSE ID given in the Destination Setup (here “DEFAULT SSL Client (Standard)”). It can be found under “Security Options” > “Status of Secure Protocol”.
Next open the transaction STRUST and navigate to the same SSL Client node given in the destination setup. Select your systems own certificate and export it as base64. Also remember the common name (CN) of the certificate (here T33_SSLC_DFAULT) as we need it later.
In the Advanced Event Mesh Cluster Manager select your broker, under the “Manage” tab go to “Authentication” and enable “Client Certificate Authentication”.
Next lets upload the client certificate. For that go back to the overview of the “Manage” Tab within the event broker and select “Certificate Authorities”. Click “Add Client Certificate Authority” and upload the previously exported certificate.
Once again go back to the “Manage” tab of the Event Broker, select “Access Control” and go to the “Client Usernames” tab.
Create and enable a new “Client Username” which matches the previously looked at common name (CN) in the certificate (here T33_SSLC_DFAULT). This concludes the setup of the first destination.
To setup the validation service destination start by locating the service key of your aem-validation-service. For that go into your BTP subaccount and locate your AEM instance under “Instances and Subscriptions”.
Next go to transaction /IWXBE/CONFIG in your S/4HANA system. Create a new channel via “Service Key” > “Advanced”.
Give the channel configuration a name, description and select the destination created before (here named AEM_BROKER_CONNECTION). Paste the service key from the BTP cockpit into the adjacent field. Then hit “Save configuration” or press “Enter” to create the channel. Afterwards activate the channel. This will also create and activate a deamon responsible for keeping the connection to AEM open and processing the events. This concludes the setup.
After the channel has been created a connection check can be performed to verify the setup. If everything is working as expected there will be two new active AMQP connections in the AEM dashboard under “Clients” in the “Manage” tab of the event broker. One for publishing and one for receiving events.
Publish a standard business event from the S/4HANA system to the AEM
To publish a standard event to the AEM you will need to create a topic binding on the channel created in the previous section. In this tutorial we will bind the standard Business Partner Changed event to the AEM.
In the transaction /IWXBE/OUTBOUND_CFG locate your AEM channel and click “Create new topic binding”. To bind the event insert the event name into the dialog and press save. The name of all standard events and their exact payload structure can be found on SAP Business Accelerator Hub. For the topic binding remove the leading “ce/”. In the case of the business partner changed event this would mean using “sap/s4/beh/businesspartner/v1/BusinessPartner/Changed/v1” for the binding. Additionally wildcards (*) can be used to reference multiple different events or event versions. “sap/s4/beh/businesspartner/v1/BusinessPartner/*” can be used to bind all business partner events. So lets use “sap/s4/beh/businesspartner/v1/BusinessPartner/Changed/*” to bind all versions of the business partner changed event.
Next create a new Queue in the AEM. Go to Queue within the Event Broker and click “Queue” and give it a name.
After creation click on the queue and navigate to “Subscriptions”. Now subscribe to the topic that was bound to the AEM channel in your S4 system. It is important to note that standard events published by S4 will always include the namespace that was given during channel creation in the topic. By default this is “S/4HANA/Events”. This time however “/ce” is included within the topic to denote that the event is CloudEvent.io conform.
Making a change to a business partner within transaction BP will now trigger an event that is being bound by the created channel. The Enterprise Event Enablement will then perform a handshake with the VMR/validation service to confirm that the AEM broker is a valid SAP broker and afterwards push the event. Since the created queue is subscribed to the topic of business partner changes the event will be queued. This can be verified by looking at the “Messages Queued” within the queue.
This series of blogs intends to show in a step-by-step way the different possibilities to use RAP Business Events with Advanced Event Mesh. OverviewIn this first blog, we’re going over the basic integration to connect Advanced Event Mesh to S/4HANA On Premise 2023. We are going over the required setup to connect the two and configuration to send standard business events, in this specific case the business partner changed event, from the S/4HANA system the the Advanced Event Mesh. Connect Advanced Event Mesh to S/4HANA On PremiseTo connect the Advanced Event Mesh to the S/4HANA On Premise system two destinations have to be created within the transaction SM59. One for the AEM broker (mr-connection-*.messaging.solace.cloud) and one for the validation service (em-pubsub-broker). While the destination for the AEM broker has to be setup manually, the destination for the validation service can be setup automatically via the service key from the BTP.For the AEM Broker destination a host URL and port is required. These can be taken from the AEM UI. Go to “Cluster Manager” and select the “Connect” tab. Next select “View by Protocol”, click on the protocol “AMQP” and select one of the client libraries to view the host URI.Next open transaction SM59 and create a new destination with type G. Enter the host and port copied from the AEM UI. While the relevant protocol is AMQP, the host URL in S/4 needs to have the protocol manually adjusted to “tcps://”. The destination should therefor look as follows:Next select the tab “Logon & Security” and set SSL to Active.The Enterprise Event Enablement integration within S/4HANA uses Client Certificate Authentication to connect to the AEM. Therefore the next step is to export the necessary certificates from S/4HANA and import them to the AEM.For that first remember the SSL Client PSE ID given in the Destination Setup (here “DEFAULT SSL Client (Standard)”). It can be found under “Security Options” > “Status of Secure Protocol”.Next open the transaction STRUST and navigate to the same SSL Client node given in the destination setup. Select your systems own certificate and export it as base64. Also remember the common name (CN) of the certificate (here T33_SSLC_DFAULT) as we need it later.In the Advanced Event Mesh Cluster Manager select your broker, under the “Manage” tab go to “Authentication” and enable “Client Certificate Authentication”.Next lets upload the client certificate. For that go back to the overview of the “Manage” Tab within the event broker and select “Certificate Authorities”. Click “Add Client Certificate Authority” and upload the previously exported certificate.Once again go back to the “Manage” tab of the Event Broker, select “Access Control” and go to the “Client Usernames” tab.Create and enable a new “Client Username” which matches the previously looked at common name (CN) in the certificate (here T33_SSLC_DFAULT). This concludes the setup of the first destination. To setup the validation service destination start by locating the service key of your aem-validation-service. For that go into your BTP subaccount and locate your AEM instance under “Instances and Subscriptions”. Next go to transaction /IWXBE/CONFIG in your S/4HANA system. Create a new channel via “Service Key” > “Advanced”. Give the channel configuration a name, description and select the destination created before (here named AEM_BROKER_CONNECTION). Paste the service key from the BTP cockpit into the adjacent field. Then hit “Save configuration” or press “Enter” to create the channel. Afterwards activate the channel. This will also create and activate a deamon responsible for keeping the connection to AEM open and processing the events. This concludes the setup.After the channel has been created a connection check can be performed to verify the setup. If everything is working as expected there will be two new active AMQP connections in the AEM dashboard under “Clients” in the “Manage” tab of the event broker. One for publishing and one for receiving events. Publish a standard business event from the S/4HANA system to the AEMTo publish a standard event to the AEM you will need to create a topic binding on the channel created in the previous section. In this tutorial we will bind the standard Business Partner Changed event to the AEM.In the transaction /IWXBE/OUTBOUND_CFG locate your AEM channel and click “Create new topic binding”. To bind the event insert the event name into the dialog and press save. The name of all standard events and their exact payload structure can be found on SAP Business Accelerator Hub. For the topic binding remove the leading “ce/”. In the case of the business partner changed event this would mean using “sap/s4/beh/businesspartner/v1/BusinessPartner/Changed/v1” for the binding. Additionally wildcards (*) can be used to reference multiple different events or event versions. “sap/s4/beh/businesspartner/v1/BusinessPartner/*” can be used to bind all business partner events. So lets use “sap/s4/beh/businesspartner/v1/BusinessPartner/Changed/*” to bind all versions of the business partner changed event.Next create a new Queue in the AEM. Go to Queue within the Event Broker and click “Queue” and give it a name. After creation click on the queue and navigate to “Subscriptions”. Now subscribe to the topic that was bound to the AEM channel in your S4 system. It is important to note that standard events published by S4 will always include the namespace that was given during channel creation in the topic. By default this is “S/4HANA/Events”. This time however “/ce” is included within the topic to denote that the event is CloudEvent.io conform. Making a change to a business partner within transaction BP will now trigger an event that is being bound by the created channel. The Enterprise Event Enablement will then perform a handshake with the VMR/validation service to confirm that the AEM broker is a valid SAP broker and afterwards push the event. Since the created queue is subscribed to the topic of business partner changes the event will be queued. This can be verified by looking at the “Messages Queued” within the queue. Read More Technology Blogs by SAP articles
#SAP
#SAPTechnologyblog