Create skill for SAP

Last Updated: 25.10.2019

With Hala, you can add a natural language interface to your SAP system, and in this tutorial, we will create a skill to unblock the user in SAP.

Step 1. At first, we need to create a Web Service on the SAP side for unblocking the user.

We will use standard SAP functional modules (BAPI) to create the Web Service.

Go to SAP and run the transaction SE37.

Search for needed functional module and press Display.

Go to Utilities - More Utilities - Create Web Service - From the functional Module.

Provide the service definition and description.

Press Cont.

Press Cont. and select Authentication with User and Password, No transport Guarantee

Press Cont. and select Local Object

Press Cont. and Complete

Now you need activate your web service by pressing the icon Activate

After the activation you will see next message:

Step 2. Now you need to make the created Web Service reachable for external applications

Go to the SAP transaction SOAMANAGER

Then open the Web Service Configuration

Search for created service, you can use the Object Name parameter to find the service. Specify in the search field the value zhala* and press Search.

In search results click on your service and then press Create Service in the next window.

Provide the Service Name, Description Text and New Binding Name. Press Next.

In the next window, enable the option User ID/Password in the Transport Channel Authentication section. Press Next.

In the next screen press button Finish

On the Configuration tab for your service, you will see the list of the Services/Bindings. You need to click on icon Open Binding WSDL Generation.

You have generated the WSDL link for your service. Use this link in Hala to create the Action.

Step 3. Go to the Integration section 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 4. Go to the Actions section on the Hala Platform, and create a new action. Provide the name for the action and select the integration.

Step 5. 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.username that 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/Execute icon or F8.

Click Test/Execute icon 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 6. 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 Intents section on the Platform and press New Utterance

Step 9. 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 10. Save your changes and train model

Step 12. Go to the Skill Kit section on the Hala Platform and create a skill by pressing the button Create skill

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

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

Step 15. 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 16. Now you need to create a child node to recognize the input from the user about the user ID.

Step 17. 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 18. 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 Mode to check the structure of the API response.

You can use the next text:

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

Step 19. 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 20. 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.

Last updated