Chatbot on S/4 HANA (Google Assistant and SCP)
This is the 1st blog I am writing. Please have some mercy 🙂 .
I was attending courses on openSAP for SAP HANA Cloud Platform and exploring it to get the best out of it. So I created few chatbots by end of the last year. This is before SAP acquired Recast.ai .
For this blog, I have created chatbot for Overdue accounts. We can ask chatbot about overdue accounts for particular customers. If there are customers with the same name, we can provide city as well. We can also send the Statement of account to customer via Email.
The Chatbot follows MVC concept. So here it goes –
- Dialogflow (by Google) – View – Face of Chatbot
Dialogflow serves NLP which we need to build the chatbot. It has all the necessary NLP components like Intents, Entities, Fulfillment and most importantly, Integrations with Google Assistant, Facebook, Skype, Alexa; which makes chatbot easy-to-use and interesting.
- SAP Cloud Platform (by SAP) – Controller – Handles and connects View and Model
SCP provides so many services and APIs. Using SCP, It is really convenient to connect to SAP ERP, S/4 HANA On-Premise and S/4 HANA Cloud.
I have created JAVA Application and deployed on SCP. The Java Application interpretes the request from Dialogflow and accordingly forwards it to SAP Systems. Here we can call APIs provided by SAP and enhance functionality of Application accordingly.
- SAP System (by SAP) – Model – Executes Database / Process Logic
SAP Systems can be connected to SCP via Cloud Connector. For that, we have options to communicate with Systems via HTTP or RFC. We can use HTTP for OData services and RFC to call BAPI and RFC-enabled Function modules.
I have created custom RFC-Enabled Function modules that have all the necessary logic based on the request from SCP.
Lets deep dive into Implementation.
The OverdueAccounts chatbot is deployed on Google Cloud. Via Google Cloud, we can assign chatbot to other users easily.
- Intents – There are 3 main intents. DisplayOverDueAccounts will provide Overdue account data. SendStatement will send statement to customer. Help intent will show some sample queries.
- Entities – Entities like Account, Customer and City are created with synonyms to construct wide range of words for Chatbot NLP.
- Fulfillment – Here goes the url for Java Application. Dialogflow will send POST request on this URL.
- Integration – We can integrate the chatbot with Google Assistant, Skype, Alexa, Facebook, Twitter and so on. I have integrated with Google Assistant.
- Java Application – Java application has been deployed on SCP which has all the logic that should be called on SAP System when It gets request from Dialogflow. For eg. When DisplayOverDueAccounts intent has sent the request, call RFC Function module ZDisplayOverDueAccounts. When SendStatement intent has sent request, call RFC Function module ZSendStatement.
- Cloud Connector – I have added SAP System to SCP via cloud connector. I have exposed only necessary Function Modules for security reason.
- Function Modules – I have created 2 RFC-based Function modules which will do all the work in the system and return the data to Java Application. These 2 Function Modules have functionalities of Transactions FB12 and F.61 .
Here is the video of Overdue Account Chatbot.
Chatbot also talks (as the name suggests 🙂 ). In Overdue Account information response, it tells only final amount instead of speaking every detail shown in screen. That makes it even cooler.
Video Description :
1st, I am showing Business Partner and its Email address. There are no Email in SOST.
2nd, Communication with Chatbot for getting Overdue Accounts Detail and then Sending the Statement to Business Partner.
3rd, Chatbot has sent Email to Business Partner that we can see in SOST.