Building the Flow
In this step we will create the automation required to create products automatically on SAP via ODATA.
The steps required are:
- Go to Office.com.
- Click on the 9 dots Icon on the Top Left
- Select Power Apps (it can also be found under All Apps)
- Go to Flows. Select New flow and pick the Instant cloud flow option.
- Select the flow properties:
- Name: Excel2SAPGateway
- Trigger: Manually trigger a flow
- Click Create
- On the newly created flow, click on the New Step button to add a new step.
- Filter by Excel Online, pick Excel Online (Business) and in Actions List rows present in a table (make sure you pick the Business version so it works with your Ofice365)
- Fill the parameters for the Excel file to be used as input:
- Location: OnceDrive for Business
- Document library: OneDrive
- File: Navigate to /Excel2SAP/NewProductList.xlsx
- Table: NEWPRODUCTS
- Click on New Step
- Let’s get the SAP credentials for the SAP gateway. Go to Custom and pick the SAPGWDEMO connector created on step #1.
- Under Actions, pick Get product
- In the Get product Action, fill the required fields:
- id: HT-1002 (must be an existing product under SAP Fiori ES5 Demo System)
- x-csrf-token: fetch (we will query and store the token for access later on)
- Now we are ready to scan the Excel file and line by line act upon the data. Add a new step, under Control called Apply to each.
- Pick value from Dynamic content, under List rows present in a table. Add a new action.
- Under Custom, pick SAPGWDEMO connector (inside the Apply to each loop)
- Pick the Add product action
- Fill the x-csrf-token with the Dynamic content from Get product
- Fill x-ms-cookie-header with the Expression below, and click OK:
replace(outputs('Get_product')['headers']['Set-Cookie'],',',';')
- Fill the remaining parameters with the values:
- ProductID: Dynamic Content Product ID from List rows present in a table
- Type Code: Product (fixed value)
- Category: Dynamic Content Product ID from List rows present in a table
- Name: Dynamic Content Product ID from List rows present in a table
- SupplierID: 0100000046 (fixed value)
- Product Tax Code: 1 (fixed value)
- Currency Code: United States Dollar (fixed value)
- Price: Dynamic Content Price(USD) from List rows present in a table
- Description: Dynamic Content Description from List rows present in a table
- Unit of Measure: each (fixed value)
- Our flow is ready ! Click SAVE
Now you should have it all setup to test the Power Automate flow.
On the next section we will execute the test and see the data on SAP.