Chat interface for SAP Bot

How to create SAP bot in 7 minutes

Andrew Rudchuk
6 min readNov 7, 2019

--

With Hala.ai, you can add natural language interface to your SAP system. Hala can help you automate IT and business processes related to the SAP software.

Currently, you can integrate with SAP by using Web Services, that you can create in SAP transaction SOAMANAGER. Later we will add the opportunity to integrate with SAP by using oData services.

Tutorial

Step 1.Go to the Integrationsection on the Hala Platform, and add the new integration for SAP. Provide the name for the integration, base URL (host name and port), your SAP username and password (you can create a technical non-dialog user for this purpose). Save your integration.

Step 2. Go to the Actionssection on the Hala Platform, and create a new action. Provide the name for the action and select the integration.

Step 3. Make the configuration of your API service.

  • WSDL url — Copy the WSDL path from the Web Service configuration, that you did on previous steps.
  • SOAP Action — WSDL can include several actions. You need to choose one action that you want to use.
  • Parameters — Here you need to specify import parameters for your service (BAPI function in SAP). In the parameter value, please specify {{context.username}}. Later, during the dialog building, we will create a context variable context.usernamethat will store the user ID that should be unlocked.

You can find import parameters by executing the needed BAPI in SAP.

Open SAP and run transaction SE37. Specify the BAPI name. Click Test/Executeicon or F8.

Click Test/Executeicon or F8.

On this screen you will see the section with Import Parameters, in our example, we have only one parameter USERNAME. You can copy this parameter and past in the Action configuration.

Step 4. You have set up integration and action. Now, you need to create an intent to recognize the user input about unlocking the user. Go to the Intentssection on the Platform and press New Utterance

Step 5. To change the default name of the intent, click on icon pencil next to the default value, or you can click on the default value, and then you will be able to modify it.

Step 6. Specify the name of the intent and press Enter

Step 7. Now you need to provide examples of how the end-users can write about unlocking the users. You need to provide at least five examples.

Step 8. Saveyour changes and train model

Step 9. Go to the Skill Kitsection on the Hala Platform and create a skill by pressing the button Create skill

Step 10. Provide the name of the skill, description, and tags (last two is optional). Press next for creating the dialog flow.

Step 11. You will be promoted to the interface for creation dialog flow. Create the first root node by pressing the button Add new

Step 12. Open the created dialog node and fill it.

  • Field Name — you can enter any value, for example “The end-user asks for unlocking the user in SAP”
  • Conditions — here you need to specify created intent intent.sap_unlock_user
  • Actions — skip this section
  • Context — skip this section
  • Output — provide the response to the user

Step 13. Now you need to create a child node to recognize the input from the user about the user ID.

Step 14. Open the child node and fill it.

  • Field Name — you can enter any value, for example “Get user ID”
  • Conditions — here you need to specify the condition input.text
  • Actions — When we got the information about the user ID, we can send the API request to the SAP. We need to add the Action that we have created previously.

When you add the action, you would need to specify the context variable where the response from the SAP will be stored, for example, context.SAP

  • Context — Here we need to save the user ID that we need unlock. Let’s assume we have a straightforward case, and when we will send to the end-user question, “What is the User ID,” we will get the reply from him — “rudchuk.” In this case, we can store all the end-user input {{input.text}}into the context variable username.
  • Output — In output you can write something like this “Please wait, I am checking the information.”

Step 15. Create a new child node to process the API response from the SAP.

Open the created node and fill it:

  • Field Name — you can enter any value, for example “Provide the results”
  • Conditions — Specify the context variable that was created for the Action Response on previous steps: context.SAP
  • Actions — skip this section
  • Context — skip this section
  • Output — In the Output, we would need to provide information about unlocking the user. To access the data from the API response, you would need to use the next prefix context.SAP.and then specify the path to the required data. You can use SOAP UI to test your Web Service, where you will see the structure of the SAP Web Service response. Also, you can use the Hala Test Modeto check the structure of the API response.

You can use the next text:

Response from SAP: {{context.SAP.RETURN.item.0.MESSAGE}}

Step 16. Save the changes by pressing button “Save Changes”. Now you have created the simple skill with one dialog node.

Remember to save your changes.

Step 17. Test the results. Go to the Hala Web Chat by using the next link https://chat.hala.ai/and type the first message in the chat. You can type one of the trained phrases, or you can use new phrases that weren’t specified in intent training.

Congratulations! You have created the skill and tested it.

Regards,

Andrii Rudchuk, Founder @ Hala.ai

--

--

Andrew Rudchuk

Father, entrepreneur, philosopher, researcher, painter, challenges seeker, and soul.