Skip to Content
Technical Articles

Build with Dash Datatable & Deploy in SAP BTP Cloud Foundry

Dear All,

I will provide a step-by-step tutorial on how to build a reporting data table using Dash, a Python framework for building analytical web applications.

Dash is a Open Source Python library for creating reactive, Web-based applications. Dash started as a public proof-of-concept on GitHub 2 years ago. We kept this prototype online, but subsequent work on Dash occurred behind closed doors. We used feedback from private trials at banks, labs, and data science teams to guide the product forward. Today, we’re excited to announce the first public release of Dash that is both enterprise-ready and a first-class member of Plotly’s open-source tools. Dash can be downloaded today from Python’s package manager with pip install dash — it’s entirely open-source and MIT licensed. You’ll find a getting started guide here and the Dash code on GitHub here.

Dash is a user interface library for creating analytical web applications. Those who use Python for data analysis, data exploration, visualization, modelling, instrument control, and reporting will find immediate use for Dash.

Dash makes it dead-simple to build a GUI around your data analysis code.

Dash User Guide

Dash Datatable Instructions

 

Prerequisites

  1. Architecture
  2. SAP Commissions tenant user with RestAPI Basic Auth
  3. Python
  4. Dash libraries
  5. Test in IDE (Visual Studio Code or IntelliJ or PyCharm or any of your choice)
  6. Test in Local Server
  7. SAP Business Technology Platform(BTP) Account
  8. SAP Cloud Foundry CLI

1. Architecture Flow

I will show IT Architecture outline below. You attempt to build and deploy automatically with using them.

 

2. SAP Commissions Tenant User with RestAPI Auth Type

  • User must have Authentication Type : Basic Authentication
  • User to test before once Link
  • Commissions RestAPI Documentation
  • In this article, we are going to extract Event Types as use case ( Normally Results table would be the real customer use case)

3 & 4 – List of Python Packages required

  • Install python in your local environment(OS)
  • Install Pip
  • Install all the below packages
pip install dash
pip install dash_table 
pip install dash_html_components 
pip install dash_core_components 
pip install pandas 
pip install base64 
pip install requests 
pip install json

5. Test in Local IDE (Integrated Development Environment)

  • Open a new window and save it as app.py
  • Write your own logic to get the JSON results and test it in your local server
  • In my case, I will be using eventTypes endpoint to get all the list of event Types.
  • run the python code python app.py

You can see Dash Server is up and Running in local web server with all the results shown in table

In SAP Commissions – Event Types

Let’s start Deploying to SAP Cloud Foundry

 

6. SAP’s Business Technology Platform(BTP) Account

  • Create your Trail Account from https://account.hana.ondemand.com/ and pick your Datacenter

To get an Production environment, Contact your Account Executive

  • Complete all the steps from https://developers.sap.com/mission.scp-1-start-developing.html
  • Once you completed all the 3 modules from above step, your account will look like similar..

7. SAP Cloud Platform CF CLI

Download CF CI to your OS

  • After you download, add cf.exe to your environment variable
  • Login to your SAP Cloud Platform Trial Account ( you have already created from above step)
  • you need to know your OrgName and API Endpoint URL ( follow the screenshot below)

  • Create the folder structure like below to upload in SAP Cloud Platform to access everyone..
Below is the example 

eventtypes
│   README.md          ### Understanding the design and developement work
│   app.py             ### Devloped 
│   Procfile           ### Command to run 
│   requirements.txt   ### List of Libraries used for application to run
│   runtime.txt        ### Python Runtime version

In your IDE, it should look like below screenshot

Run the below command to login Cloud Foundry

sapcf login -a {API endpoint}

API endpoint seen in your subaccount Follow Screenshot above highlighted with (2)

Now you can run the below command to push your files to cloud . you can prefer your choice for application name.

cf push {application name)

example :
cf push eventtypes

You can see from screenshot, deploy execution started

It will take 1min to deploy the application into your cloud environment..

Application is deployed Successfully and you can see in your Space

After selecting eventtypes, you will see Application deployed Stack Information from below screenshot.

 

Now, you can access the application anywhere, anytime with real-time results coming from your SAP Commission tenant through RestAPI event Types endpoint..

Application Events

  • you can also track all the changes made to your application

Summary :

  • Easy to build through Rest API’s and test it locally before deploying..
  • Zero-downtime for pushing the new changes to SAP Cloud Foundry
  • Easy to understand the data & can be accessed by customer anywhere to do their analyses..
  • Customer can apply Single Sign on to the application for data security..
  • Customer can apply the real use case ( Examples: Finance team to review Payments data)
  • Customer can see the application logs anytime from their sub-account ..

Final End Result

 

Contact me for more information …

Hope you find that helpful! Let me know your thoughts on this in the below comments section.

Don’t forget to share this article with your friends or colleagues.

Feel free to connect with me on any of the platforms below!


Keep watching more to come …. (Coming Next : RestAPI with Dashboards)

 

Be the first to leave a comment
You must be Logged on to comment or reply to a post.