In this article, I will provide a guide to setup SAP NetWeaver Gateway and Microsoft Power Apps such that information from SAP can be visualized in Microsoft Power Apps.
In order to get information from SAP into Power Apps we need the following components to work.
- SAP NetWeaver Gateway
- Microsoft Gateway – read more here https://docs.microsoft.com/en-us/power-automate/gateway-reference
- Microsoft Flow
Additionally, Jan-Willem Kaagman has made the following guide which explains how to setup the SAP Gateway. If you have no or limited experience with setting up an ODATA gateway in SAP, I suggest this article for further knowledge: https://blogs.sap.com/2020/11/24/introduction-to-odata-and-how-to-implement-them-in-abap/
In the next couple of articles we will dive into how to get information from the SAP Gateway into Microsoft Power Apps.
Without further ado, let’s dive into the world of SAP.
To begin with, we are going to create an API endpoint to get the number of orders for a specific material and plant in SAP Netweaver.
Firstly, we will navigate to “SEGW” to setup a new endpoint in SAP.
Here we will create a new project.
Secondly, now that we have a project, we have to define the entity type of the things we will be working with in SAP. The entity type will especially be import if we are going to be working with deep insert which will covered in a later article.
In order to create our entity type, right click Data Model – select Create – select Entity Type.
Now type in Entity Type Name as “Order” and press enter.
From here we select the properties folder in “Order” and fill in the following:
In this page we define the key combinations, as it provides us with the endpoint address to look up the orders on the specific material and plant combination.
Thirdly, we generate the runtime objects by selecting the red and white circle. You can press enter to the first screen which will pop up. In the next screen we define the packages, which in this example is “$TMP” – press local object afterwards.
Now that the runtime objects is generated, we focus on the ABA workbench for the DPC_EXT object.
In this object we can define all the back-end logic for our endpoint.
The page should look something like this:
To begin with, open the methods folder and the Inherited method folder – select the ORDERSSET_GET_ENTITY
This file is the logic for retrieving the orders for a single entity.
Right click the GET_ENTITY file – select Redefine.
The following is the code used to retrieve the orders from SAP:
Once the coding part is done, we have to check that the coding as correct.
Start by pressing “CTRL+F2” – If no syntax errors is found – press “CTRL+F3” instead as it will activate the changes. After we have activated the changes, we need to navigate to “SEGW” again. From here we will GW_HUB.
Firstly, we need to register our new Endpoint in GW_HUB.
Press register and do the following:
With our service now registered, we can go back to “SEGW” and GW_HUB – select SAP Gateway Client. This is SAPs build in client for testing API endpoints (we could also choose to use services such as Postman).
Secondly, delete the “?$format=xml” part of the url in the SAP Gateway Client as it is needed.
Thridly, press Entitysets – select our service which should be called something like “OrdersSet”.
After the OrdersSet type (Werks=’plant name’,Matnr=’material name’) it is important not to have any spaces in the url!
As a result, we can now execute the call and the screen should look something like this:
Finally, we have successfully created our endpoint in SAP which will allow us to get data out of SAP.