Hello Everyone, A very Happy Year Near to all the Community members. This is my first blog of 2020 and was on my list for quite sometime as i was struggling to set this up :)…
As we know, Business Workflows are the heart of SAP Applications and with SCP Workflows coming into existence, this Heart has grown bigger and better… Now, we can have workflows responding to actions accross systems and not just applications within a system… At the sametime we can’t ignore the Event Messaging Service (EMS), which keeps this heart beating… isn’t It??
When i started exploring the EM Service i found many good blogs like the one here by Pradeep Panda , which explains how to set up Event Messaging services with SAP S/4HANA Cloud with screen prints. But i wanted to set it up with OnPremise events , so i looked further and got SAP help link here and a wonderful blog by Paolo Sfilio which explains all the steps required to setup the EM Service to register events from On-Prem backend system.
I followed them and struggeled a bit as well as i missed the screens, to refer to, while follwing the steps. Finally, i was able to do it successfully.
Now, i thought, why not share the process with screen prints to help people set it up even faster and help them spend more time in building super cool event driven apps then in struggling with the setup.
So, lets revisit the setup process, this time with screens 🙂 …
Before, we start with On-Premise configuration we need to have following prerequisites completed:
- SCP CF Trial Account
- Subscription to Even Messaging service in SCP and Instance created for same and service key generated. (We will need, MQTT uri, ClientID, Client Secrent and token endpoint, from the generated service key, for backend component configuration)
- SAP S/4HANA Backend system
Once, we have all the above mentioned Pre-requisite steps done, we are all set up the backend system.
Configuring Enterprise Event Enablement
Configuring the Enterprise Event in Backend On-Premise system we need to perform the following configuration steps:
User Roles and Authorization – Create a role for event administrators with below mentioned role templates
Role template for Enterprise Event Enablement administrator.
With this template you can perform all admin tasks such as, checking logs, CCMS, OAuth client and RFC creation.
Role template for Enterprise Event Enablement business administrator.
With this template you can maintain the event topics for the channel.
Role template for Enterprise Event Enablement metadata administrator.
With this template you check metadata of the service, BROWSER_SRV.
- Create a new role tcode PFCG
- Chose above mentioned Templates, under Authorizatio tab, one by one and generate.
- Assign role to the required users
Upload the event messaging service certificate
To do so follow the below mentioned steps:
- Copy the Token endpoint url from the Event messaging instance service key
- Download the certificates from the URL
- Upload certificates in STRUST tcode in backed under standard and Anonymous PSE
Create an RFC Destination
- Copy the URI from the service key for the protocol mqtt311ws
- Use the URI without WSS:// to create RFC destination
- Under ‘Logon & Security’ tab, switch SSL to active and select the PSE under which EMS Certificates were loaded.
- Do the Connection test and if you get the popup to enter credentials, that means its fine, despite it being not accepting the credentials and resulting in 401 unauthorized error.
Manage OAuth 2.0 Account Client Setup
To access SCP Enterprise Messaging OAuth 2.0 protected service in S/4HANA backend system , we need to OAuth 2.0 Account Client Setup by following the following steps:
- Copy OAuth client id, client secret and token endpoint of the mqtt311ws protocol from the enterprise messaging service instance service key.
- Perform the OAuth client setup at the IMG path shown below
- Click on create OAuth client and select details as shown below and enter any name and Client ID as copied from service key
- Enter the client secret, token endpoint, Authorization endpoint (same as token endpoint with token replaced with authorize at the end) and other details as shown below
Manage Channel and Parameters from the IMG path shown below
- Navigate to ‘Manage Channel and Parameter’ at the IMG path shown below
- Create a new channel as shown below with protocol MQTT_311_WS, RFC destination as created earlier, Topic space (system ID of the backend system preferably) and description as needed
- Maintain parameters for channel as shown below
- Perform the connection test for the channel and it should be successful in case all is done properly
Activate Event Discovery Service
To discover events from SAP Enterprise Messaging in SAP Cloud Platform, activate the OData service, BROWSER_SRV. Add service BROWSER_SRV in SAP Gateway tcode /IWFND/MAINT_SERVICE
Maintain Event Topics
Before we mantain the Topics (Business Objects) for which we want to register the events, navigate to ‘Manage Service’ at the below IMG path in SPRO.
- We can see the service which generates the events under “Manage Service”
- Now we need to register topics, for which we want to register events, by navigating to “Manage Event Topics” and Selecting the channel we created in earlier steps
- Create New entry and select the required Topic filters
- Let’s say we want to capture all the events related to Sales Order, so we can select topic as shown below.
With this we are done with the Backend configuration have matained the Sales Order events to be registered in SCP EM Service.
Creating queue In SCP to register OP events
- Now we need to go to the Event messaging service in SCP account and open the EMS dashboard
- Under the Queues, created a queue (any name). Initially the Number of Messages will be blank.
- Then go to Queue Subscription and create a new subscription for the created queue and in topic space enter the value as is maintained in configuration of Channel and parameters like <topic space>/*.
With this we are done with the entire setup and now is the time to test. 🙂
- Before test let’s see how the Queue Overview looks like.As we can see there is one queue and 4 messages already.
- Now let’s make a change in the SO in the backend and see what happens.
- Let’s change the delivery date and save the Sales Order
- Now let’s go and monitor the queue in SCP and as we can see below the Number of messages is now increased by one and is 5 now.
So, our testing is successful and On-Prem events are ready to be consumed in event driven applications now!!
I would ask my friend Mahesh Kumar Palavalli , the fiori Element baba :), if he could help and create one simple sample app to show how these events can be consumed in applications , that would realy be wonderful 🙂
Keep Learning , Keep sharing 🙂