Skip to Content
Technical Articles

Challenge Submission (SAP Purchase Order – Intelligent assistant)

Introduction:

This blog post is created as a part of SAP Conversational AI Tutorial Challenge 2021. This tutorial describes about how to build chatbot and integrate with an application interface that is integrated with SAP Ariba. Our main objective is to provide a very easy way to know the status of SAP Purchase Order and also, confirm the order over a chatbot from various user channels like Facebook, MS Teams besides using the bot in the application interface.

 

Use-Case Description:

Application we are talking about was developed as a part of integrating with SAP Ariba to provide new look and feel, a fresh UI experience to the buyers and sellers who are the main actors of the application. As a part of the same requirement, we had performed a POC about integrating chatbot as well to add value to the application users about two use-cases:

  1. Knowing the status of the given SAP Purchase Order as a buyer.
  2. Confirming the status of the given SAP Purchase Order as a seller.

 

Technical Architecture:

SAP Ariba integrated UI interface application is built using SAPUI5 and Spring technologies. There are REST APIs developed as a part of the backend implementation and it supports fetching the status of the given SAP Purchase Order as well as confirming the status of SAP Purchase Order which creates an effect and keeps data synchronisation in both UI interface application and SAP Ariba.

Using the exposed REST APIs, a chatbot will be built to fetch the status of SAP Purchase Order as a buyer and confirm the SAP Purchase Order as a seller by providing various user channels with respect to chatbot usage.

 

Basics of SAP Conversational AI:

SAP Conversational AI has two main blocks: Bot UI assistant & Bot building platform.

In short, ‘Bot UI assistant’ is about providing various means for providing the UI to the user to interact and ‘Bot building platform’ is about the surface where various softwares interact in building an intelligent response to the user.

Every bot will have the following life cycle hooks (as well as ‘tabs’):

  • Train – denotes recognising and understanding statements what users will give.
  • Build – denotes building the response to be shared back to the user.
  • Connect – denotes connecting the bot with various channels (i.e. Facebook, Skype etc.)
  • Monitor – denotes monitoring the bot and improving its performance based on its metrics.

TRAIN tab:

It is about making the bot recognise and understand statements given by users using NLP (Natural Language Processing) software. Please remember that users will give in input in various languages and at the same time, any matching statement given by the user should also be recognised.

  • Intents – denotes intentions of the bot.
  • Expressions – denotes various statements conveying the same meaning.
  • Entities (Gold & Custom) – denotes the noun (or) the subject about which the bot is being built. There are two types – Gold entities refer built-in entities like date-time, place, language etc. Custom entities refer entities built within the specific bot which make main subjects of the bot.
  • Custom Entities (Free, Restricted & Regex) – In custom entities, there are three ways of creation involved and all are group of entity values. The difference is that in Free entities, it allows new value even though not defined in the group, in Restricted entities, it is a fixed set of entity values and no new (or) similar value is allowed and in case of Regex entities, it allows set of values with the same pattern in all values.
  • Enrichments (Gold & Custom) – It is about attributes of every entity created. By default, there are three attributes – raw, value & confidence and in addition, there can be N number of custom attributes added. At the same time, a golden enrichment can also be added with its pre-definedĀ  attribute values.

BUILD tab:

It is about building a skill that builds the right response to be shared back to the user.

  • Triggers – denotes on what basis, this skill should be triggered.
  • Requirements – denotes verifying whether primary & secondary inputs are met in the statement given by user.
  • Actions – denotes the place where actual response is formed by taking primary & secondary inputs and manipulating or interacting with external systems.

CONNECT tab:

It is about connecting bot built with various channels for user’s usage.

  • User channels – denotes channels where the bot being built will be integrated and made available for user’s usage.
  • Fallback channels – denotes alternative channels used to serve users during emergency or urgent priority situations.

MONITOR tab:

It is about monitoring and improving the performance of the bot.

  • Log Feed – denotes analysis of various sentences given by users.
  • Usage Metrics – denotes how every conversation, intent, skill, entity are used and performing.
  • Training Analytics – denotes capturing training analytics based on data sets.
  • Conversation Metrics – denotes a future option to be provided which is about analysing user’s conversations.

 

Step-By-Step Implementation Guide:

#1 How do I create an account in SAPĀ Conversational AI:

A minimum of name and email ID is required to create an account in SAP Conversational AI. It is very simple.

SAP%20CAI%20home%20page

SAP Conversational AI home

 

Sign%20Up

Sign Up

#2 Create your Organisation & Team:

Organisation contains many teams and a team contains many team mates and this is purely organisation concept. Now, a team consisting contributors are created under a new organisation as follows:

Create%20an%20Organisation

Create an Organisation

Create%20a%20Team

Create a Team

Organisation%20and%20Team%20is%20created%21

Organisation and Team is created

#3 Creation of SAP Purchase Order bot:

Click on the button ‘NEW BOT’ and prompts the below page. There are two kind of bots that can be created – ‘Perform Actions’ and ‘Retrieve Answers’. ‘Perform Actions’ kind of bots are used where there is a conversation involved and ‘Retrieve Answers’ will be used if there is a need to support FAQ documents.

While creating, there are options to select predefined skills, name and describe the bot along with topic it belongs to, data policy & its visibility.

purchaseorder%20bot

SAP Purchase Order bot

#4 Creation of “Intents”:

fetchorder‘ intent is created and its main aim is about fetching the status of SAP Purchase orders. As mentioned in the screenshot, there are quite a lot of expressions trained and all are denoting the same meaning – i.e. knowing the status of the given SAP Purchase order.

fetchOrder%20-%20intent%20is%20created.

fetchorder – intent is created

Similarly, ‘confirmorder‘ intent is created and its goal is to confirm SAP Purchase Order based on the given order ID. As displayed in the screenshot, there are a few expressions trained and all are denoting the same meaning – i.e. confirming the given SAP Purchase Order.

confirmorder%20-%20intent%20is%20created.

confirmorder – intent is created

#5 Creation of “Entities”:

A regex entity is created as the order ID will contain a pattern prefixed with ‘PO’ followed by three digits as suffix.

order-ref%20entity%20is%20created.

order-ref entity is created

In this example, there is no need for additional custom enrichment attributes and so, it is not created. After creation of entity ‘order-ref‘ which is common to both intents ‘confirmorder‘ and ‘fetchorder‘, in all its relevant expressions, this entity is tagged against a key word called ‘order‘ in all expressions as shown below:

confirmorder%20-%20entity%20is%20tagged

confirmorder – entity is tagged

fetchorder%20-%20entity%20is%20tagged

fetchorder – entity is tagged

#6 Building the “Skill”:

A skill is about building the response by manipulating user’s input and connecting to any external systems if required. There are three types of skills :

  • Business – denotes the purpose of the bot.
  • Floating – denotes partial or related to the purpose of the bot.
  • Fallback – denotes a skill as a fallback.
  • Triggering the skill:

In this example, this skill should be triggered when any one of the intents i.e. ‘fetchorder’ or ‘confirmorder’ is identified.

Triggering%20the%20skill

Triggering the skill

  • Verifying requirements:

Order ID is the main input being looked from the user’s statements. There are two paths – if order ID is present, then take an action else, show a message mentioning order ID is missing.

Verifying%20the%20requiements

Verifying requirements

Storing%20order%20in%20memory%20if%20order%20ID%20is%20present

Storing order in memory if order ID is present

Inform%20user%20about%20missing%20order%20ID

Inform user about missing order ID

  • Action – Building the response:

As a response, any one of the following can be returned – text, image, carousel, quick replies, card, buttons, list, client data, custom. This response can be built by manipulating given inputs, connecting to external system, updating the conversation or connecting to a fallback mechanism. There are two ways of connecting to external system as follows:

  • Call web-hook – Used to consume service which returns response in SAPĀ Conversational AI standard format and this is usually used in integrating wit SAP solutions.
  • Consume API service – Used to connect to any API service and reads the response as sent by the API service.

In this example, once order ID is identified and based on the given statement about fetching order status, ‘fetchorder‘ intent will be identified, primary input will be evaluated and response as shown below will be built by validating the order. After building the response, ‘order‘ variable is reset.

Fetching%20the%20order%20status

Building the response about fetching order status

Similarly, when statements about ‘confirmorder’ intent is given, then relevant intent will be identified, primary input will be evaluated, connectivity to external API service will be evaluated and confirmed, then the same message will be displayed to the user. After building the response, ‘order‘ variable is reset.

Building%20the%20response%20about%20confirming%20an%20order

Building the response about confirming an order

#7 Connecting to User via various user channels:

There are three user channels where this bot is integrated. First one is about ‘webchat’ integration where a script tag will be generated after giving required inputs and the same tag is copied in the UI file of the target application where ‘greetings’ skill being triggered is shown, getting the status of the order using Facebook and confirming an order using MS Teams. This is just for an example as all operations can be performed from all user channels.

webchat%20-%20showing%20greetings

webchat – showing greetings

 

Fetching%20order%20status%20in%20Facebook

Facebook – fetching order status

 

MS%20Teams%20-%20confirming%20an%20order

MS Teams – confirming an order (refer here)

Order%20is%20confirmed

Order is confirmed as shown in the API response

 

Conclusion:

I would like to specially thank:

Prabhanjan Kumar for developing the UI interface application integrated with SAP Ariba

Geetha Ranjani and Tejaswi Bitra for being contributors in the development of chatbot

Satish Babu Janardhanan for initiating this thought, encouraging and driving us into this commendable solution.

We hope that this blog post will be very useful for building a SAP Purchase Order related chatbot. Thank you for reading this blog post and kindly share with us about your feedbacks and comments on this use-case.

103 Comments
You must be Logged on to comment or reply to a post.