Few months back I started exploring SAP BTP and realized that it’s a such a huge topic in itself that its nearly impossible to learn every bit of it.

So I picked one topic SAP Conversational AI and started building a quick bot. My objective was to build a bot in conversation AI that pulls data from S4HANA on-premise system. So I started with Sales Order bot.

However few weeks back, I read on SAP service discovery center that SAP has retired their Conversational AI product. Which means now I need to find some other bot solution that help me achieve the same result i.e. Building Bot that pulls data/posts transaction to S/4 HANA on-premise.

Why I chose on-premise is because lot of customers are yet on ECC / S4HANA on-premise and not on cloud. Still they want to explore possibilities where BTP will help their business.

Building such bots will definitely ease out the job of SAP Business users from being always connected to system to perform any operation using SAP Fiori or SAP GUI. Even though SAP Fiori apps can be opened on Mobile, its not straight forward to simply open a app on mobile . Lets suppose I want to get the status of my order or invoice why not to give a simple solution of a bot that is embedded within Microsoft Teams. Users have to only use the mobile to chat with a Bot via Teams and get the details that they wish to in couple of seconds. and this to be achieved while on-premise ERP is in a secure zone.

 

So here it looks like:

 

There could be multiple ways that Power Agent or for that matter Bot developed in any other technology, can pass the data to on-premise ECC. What I am using is through BTP Cloud Integration.

Okay .. now let us understand the Architecture that I used…

 

  1. Develop custom CDS view in S/4 HANA to fetch the required data in the desired format.
  2. Develop Odata service by publishing the final consumption CDS view. See the blog https://blogs.sap.com/2016/04/06/expose-cds-views-as-odata-service/ to know how to build odata service on CDS view. If you don’t have S/4 HANA and have older ECC, you need to create Odata service using SEGW transaction that provides the required data to outside world.
  3. To enable OnPremise S/4 HANA/ECC, setup a cloud connector. Please see https://blogs.sap.com/2018/11/12/how-to-setup-cloud-connection/ to know the step by step procedure to setup the cloud connector.
  4. Create a destination in your BTP account ( you can use BTP Trial account for this POC). This destination points to your on-premise ERP.
  5. Register to Cloud Integration service and build the flow with SOAP Sender and OData receiver. This flow will accept the request from Bot in SOAP format and will forward the request to backend ERP as a OData call via secure channel. The OData response is mapped to Power Agent understandable format and forwarded to Power agent as SOAP Response
  6. Build the bot in Microsoft Power Virtual Agent and use Power Automate to send the HTTP Soap request to BTP Cloud Integration and receive the response back.
  7. You can deploy the bot in various channels like Microsoft Teams , Skype, Facebook, Twitter, etc.
  8. For this POC, I have used Teams as this is a usual chatting platform used by most of the companies.

Now lets see the above steps in details. I will skip the CDS development, ODATA development steps and Cloud connector setup as I have provided the reference to the blogs that detail out these steps.

Let us know functionally what the bot does:

The Bot I have created helps to check the order/invoice status. We can even extend this further to Change the Sales Order or Create the new Order. This bot can be used by coth Sales team as well as the Business Partners.

Now let us deep dive in the solution:

 

1. Develop custom CDS view in S/4 HANA to fetch the required data in the desired format.

I have created wrapper CDS view on I_SatesDocument that provides the required Order details. For this POC I am fetching:

  • Order Status
  • Shipping address
  • Material Stock
  • Delivery Date

My CDS view looks like

2. Develop OData service by publishing the final consumption CDS view.

3. Enable On-premise S/4 HANA/ECC, setup a cloud connector.

 

4. Create a destination in your BTP account that points to your On-premise ERP via cloud connector

 

5. Register to Cloud Integration service and build the flow with SOAP Sender and Odata     receiver.

This flow will accept the request from Bot in SOAP format and will forward the request to backend ERP as a Odata call via secure channel. The OData response is mapped to SOAP response and sent back to Bot.

Now lets deep dive in CPI flow:

 

The Sender is Power Agent bot that sends the SOAP request to CPI calling CPI endpoint.

My Sample SOAP Message looks like below

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<root>
<sonumber>6019</sonumber>
</root>

</soap:Body></soap:Envelope>

 

The user credentials used by Power Agent should have EABMessaging.send Role.

In Content Modifier, I read the Sales order number value from incoming SOAP message and store the value in header property.

Then I have added Request-Reply step to pass Sales order number to S/4 HANA backend via odata service call through cloud connector and receives Sales Order Details

 

Below is query to call odata service passing sales order number.

 

The Odata response is mapped to SOAP response and will be sent back as a reply. I have used simple one to one mapping for the POC.

 

Now lets look at Microsoft Power Agent

I will not get in to details on how the bot is developed in Power Agent. You can check the link above to know the detailed tutorial. I will directly show you the step in power automate where the SOAP call to sent to BTP CPI.

Inside the Power Automate flow you will add the HTTP POST request to CPI end point and fetch the response back.

 

 

Please add the user credentials in the “Show advance option”. I have used Basic authentication for this POC.

Instead of Power Agent and Power Automate you can use any other Bot building technology that can call the HTTP POST request to CPI .

Publish the Bot on teams or any other channel like facebook , Skye and you are all set to go 🙂

 

Conclusion :

So to conclude , though there are multiple UI options where business users can perform the same tasks, few tasks like approval or quick data check can be achieved using Bots simply deployed on corporate channels. It eases the users job and gives them quick access to data for better decision.

Technically it is very ease now to integrate non-SAP channels  with SAP Backend system to pull the data or post the transaction (We saw in the blog)

I would like to hear from all of you, you comments/ feedback on what I tried sharing with you all. Hope this helps you all to continue you BTP journey.

 

For more details,

Please visit SAP Business Technology Platform environment Topic page https://community.sap.com/topics/business-technology-platform,

You may also visit Question/Answer page for more content at https://answers.sap.com/tags/8077228b-f0b1-4176-ad1b-61a78d61a847  and read other posts on the BTP https://blogs.sap.com/tags/8077228b-f0b1-4176-ad1b-61a78d61a847/

Thank you and keep learning 🙂

 

Sara Sampaio

Sara Sampaio

Author Since: March 10, 2022

0 0 votes
Article Rating
Subscribe
Notify of
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x