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