Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 


Dispute management is an area in Finance which involves a lot of manual effort, especially in B2C companies. Receiving customer complaints, logging them as dispute cases in SAP, processing of the cases and subsequent actions such as issuing credit memos are various time-consuming manual activities involved in the process, which has the potential for automation.

Therefore, we have developed a solution which is leveraging SAP Conversational AI and related SAP Cloud Platform technologies to handle Dispute cases. Please go through the business blog post , for more details on the business driver of the solution, and a video demo explaining the customer view & Sales agent view of the solution.

In this blog post, I would like to give a detailed overview of technical architecture and how each of the solution components are integrated.

Solution Overview

Dispute management chatbot solution is implemented by leveraging intelligent SAP Cloud Platform technologies - SAP Conversational AI(CAI), SAP Intelligent RPA(iRPA) – interfaced with S/4HANA on-premise system using Cloud Platform Integration (CPI) as a middle ware.

Technical architecture of the solution looks like below:

Figure 1: Solution architecture

How the chatbot is interfaced with S/4HANA Dispute management and iRPA?

Chatbot is designed using SAP Conversational AI and it consists of various intents, entities and skills. I assume you all have a basic idea of modelling a chat bot, hence the focus of the blog post is not to explain how each intents and skills are built, instead to touch base on how the chat bot is interfaced with S/4HANA Dispute management and iRPA.

In our design, chatbot is calling external services / systems, using one of the below options:

  1. API call to S/4HANA on-premise system via CPI

  2. Webhook call to Node JS script deployed in SAP Cloud platform, which in turn triggers a call to S/4HANA on-premise system via CPI

  3. Intelligent RPA call from Conversational AI

In the latest version of SAP Conversational AI, there is a feature called “System alias configuration” under Settings tab of chatbot. Here you can maintain the base URL & authentication details, to enable different API calls.

We have maintained system aliases for CPI connectivity, Node JS call and SAP iRPA triggers, as depicted below:

Figure 2: System Alias Configuration in SAP CAI

API call to S/4HANA on-premise system via CPI

We have used CPI as a middleware, to route our API calls from CAI to S/4HANA on-premise system. Usage of CPI have multiple advantages:

  1. CPI provides an easy integration with S/4HANA system. For eg:- if there is a need to route the API calls to a different system or the ODATA API’s on S/4HANA are updated, we just need updates at the CPI & chatbot need not be modified. i.e. the interface connectivity between Chatbot and CPI remains intact when a change happens on the S/4HANA side.

  2. Central monitoring of the messages – It’s very difficult to troubleshoot issues related to a chatbot communication, logging of messages in CPI helped us to pinpoint the root cause of failed messages.

  3. Replacing NodeJS scripts - We were using NodeJS scripts to format the output messages. It was possible to move the logic of NodeJS scripts into SAP CPI with additional mapping. It is also easier to upgrade the iFlows than the NodeJS script when there is a change/migration in S/4HANA environment.

  4. SAP Conversational AI had limitations for fetching CSRF tokens during POST method calls. We managed to achieve it using CPI.

Below screenshots give an idea of how the POST calls were handled in our use case:

Figure 3: POST method call from CAI

Figure 4: iFlow in CPI

Multiple Integration Flows (iFlows) were designed in CPI to achieve the overall integration for this use case, such as Customer Info, Dispute set, Invoice details etc

SAP CPI is integrated with on-premise S/4HANA with SAP Cloud Connector. SCP sub-account which hosts CPI service is maintained in the Cloud Connector, along with access control to S/4HANA system. This enabled a secure connection between CPI and S/4HANA for the consumption of required ODATA messages.

Webhook call to Node JS script deployed in SAP Cloud Platform

There are certain cases where you need to format the result list from S/4HANA system, to a specific format in the chatbot, so that users get the list in an elegant manner. For this purpose, we have used Node JS scripts & deployed it in SAP Cloud platform. The scripts in turn triggers a call to S/4HANA on-premise system via CPI, retrieve the list output , format it as per our needs and send back to the chatbot.

See below an example where Node JS scripts were used to format the output:

Figure 5: Formatted list output using Node JS scripts

Intelligent RPA call from Conversational AI

We have integrated Intelligent RPA with Conversational AI, to perform certain activities, triggered out of chatbot.

For eg:- Once the dispute case is created, Sales agent has the option to use the chatbot and initiate follow up actions, such as creation of credit memo.

Figure 6: Follow up actions from chatbot triggers RPA

From the Conversational AI, RPA calls are triggered, similar to an API call.

Figure 7: Call to iRPA project from CAI

Trigger details such as URL and irpa-api-key can be fetched from SAP Cloud Platform - Intelligent RPA factory

Figure 8: iRPA trigger details from Intelligent RPA factory

How the end users interact with chatbot?

Chatbot is designed to interact with customers as well as Sales agents.

  • Customers can login via third party interaction options provided by CAI, such as Facebook messenger, Telegram, Twitter etc.

To connect with any 3rd party application, you just need to follow the steps mentioned in CAI. Please note, different steps need to be executed, depending on the 3rd party application. In our use case, we have integrated chat bot with Facebook messenger.

Figure 9: Triggering chatbot from Facebook Messenger

Facebook messenger channel connection can be established by following certain steps such as creating a Facebook page, creating a Facebook app via Facebook developers page, get page token & app secret and maintain it in CAI channel. Subsequently maintain the call back URL and token, and you’re ready to go.

Figure 10: Connecting chatbot with Facebook Messenger

  • Sales agents can login via a Fiori Launchpad plugin

Sales agents are SAP users who have access to S/4HANA on-premise system & Fiori launch pad. They can use the chatbot and initiate follow up actions, such as creation of credit memo. We have enabled a custom button in Fiori launchpad , which helps the users to launch the chatbot (refer Figure 11).

Figure 11: FLP plugin to launch the chatbot

Following steps were executed, to enable a custom button on Fiori launchpad, which opens up the chatbot:

    • Webchat user channel was created, which provides a webchat script with channel ID and token.

Figure 12: Webchat user channel in CAI

    • Create a Fiori Launch pad plugin. SAP Web IDE provides an FLP plugin template, which makes our life easier.

Figure 13: Fiori Launchpad plugin

    • Maintain the webchat channel ID and token in the FLP plugin source code

    • Deploy the FLP plugin application to the S/4HANA backend. You can do this from SAP WebIDE using option Deploy to SAP UI5 ABAP repository.

    • Define FLP Settings and Plugins in S/4HANA system using t-code /UI2/FLP_CONF_DEF & activate it using t-code /UI2/FLP_SYS_CONF


Intelligent dispute processing use case we explained in these two blog posts demonstrates how intelligent SAP Cloud Platform technologies - SAP Conversational AI(CAI), SAP Intelligent RPA(iRPA) - can be leveraged to build solutions which brings great business value & a potential for process optimization.

Learn More

We have demonstrated the entire solution in an SAP Community call, recording of the session is available here. Please review the session if you need more details.

For more information on SAP CAI and SAP Intelligent RPA:
Labels in this area