What is SAP?
SAP is the market leader of Enterprise Resource Planning software in the world. SAP was first founded back in 1972 and it has evolved over the years to become one of the most comprehensive ERPs across the globe.
SAP allows organizations to run all day-to-day business processors in one software platform. It handles business processors of Sales and Distribution, Manufacturing, Supply Chain Management, Human Resources, Financial, etc in one integrated platform. Hence, there is a high demand for third-party applications to integrate with SAP’s eco-system and interact with the data it holds.
The latest version of SAP is SAP S/4 HANA. This version runs on SAP’s propitiatory in-memory database technology named HANA.
Prerequisites for Setting up Connectivity Between SAP to Power Apps
- .NET connector
- SAP Gateway
What is Microsoft Power Platform?
Power platform is a collection of Microsoft components that integrate with Office 365, Dynamics 365, Azure, etc to provide end-to-end business solutions.
Components of Power Platform are,
- Power BI
- Power Apps
- Power Automate
- Power Virtual Agent
Power BI
Power BI provides a business analytics service that helps to deliver insights for the users. Users can utilize a collection of visualizations to build a report and then dashboard can be created using multiple visualizations from multiple or single report. Power BI is the analysis and insights leg of the Power Platform.
Power Apps
Power Apps provides a platform to create low code web and mobile applications faster. There are three types here Canvas, Model Driven and Portal. Canvas is where you would start with blank screen and built your application. Model driven is where you will start with data which lives in common data services platform and it’s much easier to connect to a CDS Model. Portal is where you would expose your common data to external users.
Power Automate
Power Automate makes it easy for us to automate our tasks. This also consists of the possibility of creating RPA (Robotic Process Automation) and workflows. It has more than 370+ pre-built connectors which users can utilize.
Power Virtual Agent
Power Virtual Agent is a low code method to create chatbots and you wouldn’t need a data scientist to build it. Power Virtual Agent can connect with Power Automate and this helps to take actions in response to the customer responses which you are getting. If you have any existing skill developed in bot framework you can use this skill in Power Virtual Agent.
Power App to SAP Integration Method – BAPI
Out of a vast number of ways SAP can be integrated with third-party applications, BAPI concept is one of the proven methods over the years. BAPI stands for Business Application Processing Interface.
SAP database contains a huge collection of business documents. BAPI’s provide an interface for third-party applications to access these business objects in a secure and standardized method.
For example, business object Sales Order has its own set of BAPIs.
BAPI name | Purpose |
BAPI_SALESDOCU_CREATEFROMDATA | Create a sales order |
BAPI_SALESORDER_CHANGE | Change or Update a sales order |
BAPI_SALESORDER_GETLIST | Fetch a list of sales orders |
Out of the box, SAP has provided these standard BAPIs for most (if not all) business objects in SAP. Standard BAPIs always have the prefix (or text) BAPI_* in their names. Using SAP transactions either se37 or swo1, one can access and simulate these BAPI function modules.
Power Apps to SAP Integration Scenario Overview
For this illustration, we will build an application in the Power App platform to fetch exchange rates from SAP S/4 HANA backend system.
Power App User Interface:
Users can select ‘from currency’ and ‘to currency’ from a drop-down list at the front end of the Power App interface.
Users can use the slider to define the amount they want to convert. The currency value converted to will be displayed when the user clicks on the ‘Check’ button. Also, the exchange rate fetched from SAP S/4 HANA will be displayed in the ‘Exchange Rate’ text box.
Integration Design:
We will make use of the function, BAPI_EXCHANGERATE_GETDETAIL to retrieve the exchange rate between the two currencies from SAP S/4 HANA.
From the power App platform, a request will be sent with the currency codes to BAPI in the SAP back-end system. BAPI is expected to return the exchange rate between the given currency codes. In the front end, the amount is multiplied with the exchange rate factor retrieved from SAP to show the converted amount.
Integration Simulation in SAP Back-end System
Let’s assume we want to convert USD to EUR. To illustrate how the BAPI accepts the currency codes from the front end and how it returns the exchange, let’s simulate the BAPI directly in the SAP back-end.
Go to transaction se37 in SAP S/4 HANA and enter the BAPI name.
Next enter the input parameters as follows.
Rate_type value “M” is an SAP internal value. Along with “From_curr” and “To_curr” we will enter the “Date” as today’s date.
Press the execute button and BAPI return will be shown in the next screen.
The exchange rate between USD to EUR is 0.85. This is the return parameter we are interested in.
Application and Flow Implementation in Power Apps
Use the ERP connector in the Power Apps to call the BAPI.
End-to-End Integration Simulation
Let’s simulate the power app via the Power Platform portal.
To access the custom app, first, login to the Power apps portal and go to Apps and then click on the app.
The user interface of the app will be displayed on the next screen. Input the values in the user interface and click on the “Check” button
The exchange rate interfaced from SAP and the amount converted will be shown as below.
How to Debug Power App Integration with SAP HANA?
To check the processing of the request and response, go to Flows from the left-hand side menu.
Here you will be able to view each instance the Power Apps application was invoked.
Within this view of the Flow, it shows the status of each milestone of the processing pipeline.
You can drill down to details of each processing unit. For example, the processing unit of the ERP connector, “Call SAP Function” will show the parameter detail of the request and response messages.
If you have any questions regarding Power Apps, SAP S4 HANA or any of the steps illustrated in the article, please leave a comment below.
Also, you can check out the article in D365Bits and our webinar for further information.
Good afternoon. I’m curious the limitations for this connector – for example how many active users would be a good fit. For example if I wanted to use Power apps through Power portal for a B2C use case – what would be the max number of simultaneous connections the system could handle?