Create Sales Orders and Analyse Sales Volume of SA...
Enterprise Resource Planning Blogs by SAP
Get insights and updates about cloud ERP and RISE with SAP, SAP S/4HANA and SAP S/4HANA Cloud, and more enterprise management capabilities with SAP blog posts.
SAP Business ByDesign (ByD) enables integration with Natural Language Processing (NLP) enabled devices like Alexa using OData services to create, update, delete and read transaction and master data in ByD.
In today’s world where technology continues to make our work bit easier and more flexible. We look at new cutting edge technologies and ask ourselves, how can SAP Business ByDesign (ByD) interact with voice based smart device? That’s what we have done with Alexa meets ByD, we’re excited to share the blog which explains in detail how to integrate Alexa with ByD and fulfill real world business scenarios. This blog also showcases how ByD is open for any Natural Language Processing (NLP) based integration using ByD APIs. This is not a core feature of SAP Business ByDesign, it is a showcase that demonstrate the openness of ByD integration and possible integration of ByD with Alexa.
This blog post provides information about how to create data in ByD using custom OData services build on business objects using OData modeler. For details about how to create custom OData services in Business ByDesign, please refer to video: SAP Business by Design – How to Create an OData Service
Alexa (Amazon Echo’s persona) has several capabilities (Skills). Those are divided between Native (time, weather, traffic, news…) or Custom Skill (Uber, Spotify, Business ByDesign, Business One…)
To activate the custom skill, we use Invocation Names. Those are nothing more than the name of the skill we want to call. For example: “Alexa, ask ByD for Sales Volumes of Last Quarter” or “Alexa, ask Uber for a ride” or “Alexa, open Spotify”. Once it hears your command, it will identify the skill to be triggered and call a specific Web Service that can be hosted on a Private Cloud or on AWS. Like this:
In our case, working the with ByD Digital Assistant Skill the architecture is:
Invocation name is the key word used to launch the application, example ‘bee why dee’ ( user could enter any desired name )
5. Enter the Intent name
Intent is the key word which will unuquly identify possible set of questions. Each intent corresponds to a question to fulfill specific functionality.
Exmaple intent is ‘Make Purchse’, which has set of possible questions like ‘CreateOrder’
6. Enter the Endpoint
The Endpoint will receive POST requests when a user interacts with your Alexa Skill. The request body contains parameters that your service can use to perform logic and generate a JSON-formatted response. Learn more about AWS Lambda endpoints here. You can host your own HTTPS web service endpoint as long as the service meets the requirements described here.
Service Endpoint Type decides how you will host your skill’s service endpoint, one option is AWS Lambda ARN: Host your endpoint using AWS Lambda, a service-less compute service, other option is HTTPS: Host your endpoint using HTTPS web-service that you manage,
Note : Service endpoint is the URL of the web-application which takes the JSON request and returns back web-service response which will be rendered and processed by Alexa device at run-time.
Step 3: Build Web-Service
Build web-service and deploy the service, the web-service endpoint URL is used in Alexa skill endpoint configuration.
Web service acts like a middle-ware application, which performs the following task:
Processes the JSON web-service request, which is in predefined format from Alexa service
Identify the Alexa Skill intent
Based on the intent construct the ByD OData service request body
Fills the ByD OData service request header information including Authorization details
Calls the ByD OData service
Parses the ByD OData service response
Construct Alexa service response, based on ByD OData response
For sample showcase purpose we have built a web-application using NodeJS.
Steps to develop web-application using NodeJS.
Download NodeJS installer and install the operating system specific installer.
Set the environment variables PATH with the folder of NodeJS
Download the code from the tutorial that is shared on GitHub
Open the file bydDigitalAssistant.js in editor like visual studio code
Enter the URL of the SAP Business ByDesign system
Enter the User credentials of theSAP Business ByDesign system
Step 4: Deploy Web-Service
Deploy the web-service in any web-server, after successful deployment the web-service endpoint URL is used in Alexa skill endpoint configuration.
For demo purpose we have used SAP Cloud Platform(SCP) to deploy the web-application. Once the successful deployment is done the service is up and running.
Note: to use deploy the application using Cloud Foundry Command Line Interface, please install Cloud Foundry Command Line Interface (cf CLI), for detailed steps please refer to Installing the cf CLI
Now you also can deploy the Alexa skill locally or cloud foundry as standalone NodeJS app. Follow the steps below:
Step 1: Deploy on a Sap Cloud Platform(SCP)with node run-time or the standalone ByD Digital Assistantlocally .
To deploy on SAP Cloud Platform Cloud Foundry, run the command below: (Preferred option)
$ cd ./Alexa-Meets-ByD-Sales-Info (navigate to root folder of the project )
$ cf push –random-route
Note: the web-application is successfully deployed
To deploy locally, run the command below: (Expert option)
$ cd ./Alexa-Meets-ByD-Sales-Info
$ npm install
$ npm start
Step 2: Update the end point of alexa skill with HTTPS instead of AWS Lambda ARN in the configuration section of your Alexa skill.
code
Step 5: Link the function to your Alexa Skill and Test.
Whatever option you choose before, at the end you should have an endpoint for your function. I.e., an ARN if you are using Amazon Lambda, or an URL if you pushed the app to SAP Cloud Platform.
Back to the Amazon Developer Console (the same as step 2). Choose the right the menu Endpoint and set the right option for your case.
Your ByD Assistant is ready to work! You can use the Test Console (open your skill in Alexa Skills Kit Developer Console and use the Test option using Alexa Simulator), for mote details please refer to video Alexa Skills Kit Developer Console: Test or use the Echo Simulator or with a real Amazon Echo by enabling the Skill on your Alexa app. Which is much cooler ?
Scenarios Tested:
Scenario 1: results of Sales Volume analytical report.
For details about How to integrate Business ByDesign with Alexa, please refer to blog: Alexa meets Business ByDesign
Next Blog (Complex scenario)
Lets assume a sales representative who would like to address the sales orders that are delayed since yesterday, would like to know how many orders are delayed, which customers are affected and call the affected customer and inform about the delay and would like the phone call activity to be recorded in ByD. Sales representative has access to Alexa device and would like to to realize the business scenario.