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: 
I've come across numerous blog posts on SCN community about connecting Amazon Alexa to SAP. These posts have intrigued me to try them out for myself! So, I took this opportunity to see if I could utilize the free/trial developer platforms + tools that SAP has made available for developers to connect my Amazon Echo Dot with an on-premise SAP server to perform some simple requests and get a response.

Here's the video of the final result - Alexa getting the total supplier spend by country from SAP!

If you're interested to get an overview on how this was developed, read-on!

Free is always the BEST!

I've used the following platform / tools from SAP for this demo. All of these tools/platform are available for download for FREE!!! I won't cover the installation or setup process of the tools below because there are already detailed step-by-step instructions available - see link next to the required platform/tools.

  1. A working installation of SAP NetWeaver AS ABAP 7.50 SP02 on SAP ASE (Developer Edition) - . For steps on the installation process, these two blog posts were a great resource - and

  2. SAP Cloud Connector downloaded and installed on the same server that is running the SAP NetWeaver AS ABAP 7.50 -

  3. An active trial account on SAP Cloud Platform with SAP Cloud Platform - API Management enabled.

What's the story?

To build this demo, I came up with a simple business requirement for having Alexa get the 'Total Supplier $ Spend' from data in the SAP NetWeaver Enterprise Procurement Model (EPM) EPM_V_PO_SUPPL view which conveniently contains the value of he Purchase Orders issued to suppliers and the supplier's details such as the country. ** If you need an overview of the SAP NetWeaver Enterprise Procurement Model, here's a direct link to the SAP PDF -

Below is a screenshot of the data in EPM_V_PO_SUPPL from my SAP server instance with an ALV layout applied so that the results are summed by the GROSS_AMOUNT and grouped by BP_COUNTRY. This is the data that I'll work with for the setup of this demo.

Let's assume that the two requirements in this demo is to (1) return the top three countries with the highest $ spent and (2) return the total sum of PO value for any country that the user request for.

Getting it to work...

Here's an overview of the steps that I've done to make this demo work.

  1. Develop a BSP application, write the ABAP code and make sure that the service is active in SICF

  2. Connect local on-premise SAP server to SAP Cloud Platform using SAP Cloud Connector

  3. Enable SAP Cloud Platform - API Management and publish an API so that it can be consumed by Alexa Skills Kit

  4. Create a custom skill on the Alexa Skills Kit

  5. Run test on Alexa Skills Kit - Developer view

  6. Time for a real test on an actual device!

Design, coding, design, coding...

Reading through the other SAP SCN blog posts and other forums on the Alexa topic, every one of them have deployed different approaches on how to retrieve data from SAP.

In the setup of my simple demo, I have developed a BSP application with a Controller class to handle the request coming in from Alexa and sending a response back to Alexa by using a View. There are obviously other ways in ABAP to do this, namely through an OData service which is definitely the more recent and preferred approach as craig.cmehil has explored in one of his blog posts -

I chose to use the BSP application approach as I have experience working with BSPs and I wanted a quick, easy and 'dirty' way to make this demo work purely through ABAP coding. Below are a few screenshots of how I've designed the BSP application.

Created a BSP application with one Controller and one View

BSP Controller definition with a Controller Class

Create Controller Class and redefine the DO_REQUEST method to handle incoming requests

The core ABAP coding of the functions in the method DO_REQUEST is to:

  1. Determine the type of Intent sent from Alexa - There are three possible values: LaunchRequest / IntentRequest / SessionEndedRequest - I'll mainly focus on IntentRequest in this demo

  2. When it is an IntentRequest, determine the Intent name and call the relevant private methods to select data from SAP and structure a response back to Alexa

  3. Use the View 'RESPONSE.HTM' to return a valid JSON response back to Alexa

Once the ABAP coding is done, activate the BSP application and the Controller class and then, head over to SICF and make sure that the service is activated.

Now, if I run a test of the BSP application with the current set up, this is the response that I get.

Sweet! This proves that the BSP application is active and working - This'll have to do for now as I do not have an actual valid JSON POST request from Alexa to send to the controller class in order to get a valid response.

Time to meet the outside world

Now, I need to connect my local on-premise server to the SAP Cloud Platform through SAP Cloud Connector so that I can reach this BSP application from the wonderful world of the Internet.

On the local on-premise SAP instance, I've downloaded and install the SAP Cloud Connector and create a new system mapping for Cloud To On-Premise. 

Ran a check on Cloud Connector to make sure its reachable...

Re-check it again on the SAP Cloud Platform - Cloud Connector that we're connected and all ready to go!

Exploring APIs

SAP has made available various services to connect a backend service and make it available to be consumed from the "outside" world and the API Management on SAP Cloud Platform is one of those services. This was a great chance for me to get some basic hands-on experience with the API Management service and to explore.

By default, I found that the API Management service is not enabled on my SAP Cloud Platform trial account. So, enable that first!

Then, jumped right to the API Portal and create an API Provider. Here I named it appropriately as "backend_npl"

With the API Provider created, I can now create an API that will be able to communicate with the BSP application that I've created and activated earlier.

Closing in on the finish line

At this point, I'm now done on all the SAP related steps. Moving on to the Amazon developer site for setting up of a custom skill on the Alexa Skill Kit (ASK) -

Skill information

Here I've set the invocation name as "total supplier spend"

Interaction Model - Intent Schema

"intents": [
"intent": "TopThree"
"intent": "ByCountry",
"slots": [
"name": "Country",
"type": "AMAZON.Country"

Interaction Model - Sample Utterances

TopThree get the top three countries
TopThree list the top three countries
TopThree list top three countries
TopThree for top three countries please
TopThree for the top three countries
TopThree by top three countries please
TopThree by the top three countries
TopThree on top three countries
TopThree top three countries
ByCountry what about {Country} please
ByCountry what about {Country}
ByCountry how about {Country} please
ByCountry how about {Country}
ByCountry details on {Country} please
ByCountry details on {Country}


On this screen, I entered the API Proxy URL that were deployed on the SAP Cloud Platform - API Management service

SSL Certificate

Didn't have to worry about the SSL certificate since the API Proxy URL is already served in HTTPS

OMG! It's alive!

I'm very excited at this point! The ASK allows me to run a test without directly using my Amazon Echo Dot by simply typing in the utterance and hitting the API Proxy URL for a quick test So, this is what I imagined that I would say to get the list of top three countries by total supplier spend.

"Alexa, list the top three countries by total supplier spend"

Here's the complete Service Response returned... WOO HOO~
"version": "1.0",
"response": {
"outputSpeech": {
"type": "PlainText",
"text": "The top three countries by total supplier spend are Japan , Germany and France . The total spend of all three countries are $419002.41."
"shouldEndSession": false
"sessionAttributes": {}

Going back to the SAP Cloud Platform - API Management - API Portal dashboard screen, I could also see that this API has now been triggered once - and definitely more to come!

And the rest is history if you've seen the video at the top of this post.

Final thoughts...

The set up above was definitely meant for a developer proof-of-concept type of implementation. I've purposely left out any details on authentication / identification as that is an entirely separate topic on its own.

Building this demo has definitely satisfied my curiosity in creating a custom skill with Amazon Alexa and also gave me valuable and fun learning experience utilizing services such as the SAP Cloud Platform and API Management.


Part one: Amazon Alexa + SAP ABAP AS 750 (Developer Edition) + SAP Cloud Platform (Trial) with API Management (This post)

Part two: Visualizing Amazon Alexa’s response with SAP ABAP AS 750 (Developer Edition) + SAPUI5

Part three: Verifying Amazon Alexa requests with SAP Cloud Platform – Cloud Foundry + API Management
Labels in this area