SAP Work Manager Forms with Power Apps
This blog will explain how to use Microsoft Power Apps with SAP Work Manager to allow for entry of forms data that needs to be associated to a SAP work order number.
Prior to the implementation of mobile applications and devices, paper forms were the norm for most field technicians. SAP Work Manager allows technicians to process SAP PM orders on a mobile device but does not provide a method for the structured entry of non-SAP data such a form. The information can be recorded in the long text of the order, but this method was not satisfactory as it was difficult to search for the information and allowed room for fields to be missed.
As a result, many paper forms remained even after the deployment of the SAP Work Manager mobile application. We introduced a simple solution to allow for the replacement of paper forms with digital data entry with a loose integration of SAP Work Manager and Microsoft Power Apps. The form data is now entered on the mobile device, associated to the SAP PM order number, but stored in SharePoint lists.
The solution described below was built using the Office 365 cloud-based software by Microsoft. Single sign-on with Office 365 had already been implement which eliminated the need for our users to sign-in separately to the Power App described.
Step 1: Create SharePoint Lists to Store Form Data
A SharePoint list is not the only data source that could be used, any data source that connects to Power Apps would work as well, we chose to use SharePoint lists. I am not going to describe how to create SharePoint lists in this blog post, there are plenty of resources online regarding SharePoint lists. The important part is that the list must include an Order Number column and require this be populated for each record. It is best for the name of this column to be the same in all the SharePoint lists used. We also added a calculated column that opens the order in SAP transaction IW32 in the SAP Web GUI, using the order number in the record, to allow back office users to easily access the order in SAP from SharePoint.
Step 2: Create Power App
Power Apps is a low-code solution from Microsoft that allows users to build custom applications. Form entry applications can be built easily in Power Apps with validation options to ensure the required data is entered before it can be submitted. The home screen on our Power App has the various forms that can be entered or displayed:
Before the user can access the Home screen to enter or display forms, they are required to have an order number, which is 12345678 in this example. Using parameters in our link from Work Manager, the user does not need to enter this number manually (more on this later).
The user selects the form they wish to enter or display. The Power App searches to see if there is an existing form and will display it if it is found. If none exists, it will navigate the user to the new form entry screen:
Forms can be created to allow a single entry or multiple entries per order. The various form screens can also be built to allow the user to update existing forms.
The key to this solution is to pass the order number to the Power App as a parameter in the URL. Once the Power App is published, it will be hosted in Microsoft’s cloud and have a URL for users to access it in web browser (or the Power Apps app on iOS devices). The order number can be passed as a parameter in the URL and the Power App will look for this parameter and respond accordingly.
The Power App OnStart formula below checks if the OrderNumber parameter is present in the URL, if it is, it sets the orderNum variable to the OrderNumber parameter and navigates the user to the Home screen shown above. If the OrderNumber parameter is not present, it navigates the user to a screen where they are prompted to enter the order number before they can proceed to the Home screen.
This allows the user to click a link such as https://apps.powerapps.com/yourappnamehere?OrderNumber=12345678, the Power App would see that the order number is 12345678, store that number in the orderNum variable and navigate the user to the Home screen.
Each form then would set the Order Number field in the SharePoint list equal to the orderNum variable so every form would be associated to the SAP PM order number, all without the user having to enter the order number!
Step 3. Work Manager Dynamic URL
A dynamic link is then added to the order in Work Manager that sets the OrderNumber parameter to the order number for which the user has open. If a user is viewing order number 10379213, the link would be https://apps.powerapps.com/yourappnamehere?OrderNumber=10379213. Multiple parameters can be passed in a URL, this is done by separating them by an ampersand (&).
The link was made configurable by client, Plant, Order Type and Maintenance Activity type. This allows us to only make the link available on the orders for which it should be used.
The solution works like this:
- Work Manager user clicks dynamic link on Work Manager order which passes the SAP PM order number as a parameter in the URL
- The link launches the Power App which sees the order number parameter and stores the order number as a variable
- Power Apps uses the order number variable stored to search for existing forms or as the order number value on all new records the user creates
- The form data submitted creates a record in a SharePoint list
- Back office users can review the information in the SharePoint list or in the Power App
- A link to open the SAP PM order in the SAP Web GUI is automatically added to the SharePoint records as a calculated column, this allows users to easily open the SAP PM order associated with that record in transaction IW32 from SharePoint