SAP Business ByDesign is created on an open platform that allows us simple integrations with external applications to generate business solutions with added value.
Today we want to show how to integrate SAP ByDesign with Microsoft Flow, using web services, which will allow us to achieve things like creating folders and documents in Microsoft SharePoint.
You can use the same procedure to create tasks in Outlook or in Google, for example.
These are the type of requirements that we find in some clients, and are not standard features of ByD, but as I’m going to show you, it is possible and so easy to implement them.
You need an account with access to Microsoft Flow and Microsoft SharePoint Online.
We’re going to use SAP Cloud Applications Studio, so you’ll need too. Remember that you need the version corresponding to your tenant.
In our case, the tenant is in version 1905, so we need the same version of SAP Cloud Applications Studio:
Creating Flows in Microsoft Flow
Go to your account in Microsoft Flow to create a new flow.
In “My flows”, choose “+New > Automated-from blank”:
Name your flow and press “Skip”. Then you can choose what event trigger your flow. Search for “When a HTTP request is received” and select it:
Here, you can choose the option “Use sample payload to generate schema”:
When you press “Done”, the system creates the JSON schema for your request:
As you can see, the HTTP POST URL for your flow will be generate after save the flow. This URL will be used from SAP ByD to trigger the flow.
Action: Create a folder in SharePoint for your project
You press “New step” button to add an action to your flow. We want to create a new folder in Microsoft SharePoint for each project in SAP ByD, but if you look for an action called “create folder” you couldn’t find it.
We need to use a workaround and select the action “Create file”:
Fill parameters needed. Something like this:
- Your SharePoint online site.
- A folder path in your site (I’ve create a folder call SAPByD in our Shared Documents folder to act as the root folder for our projects folders). I’ve add “/” and the dynamic content “project” (the project code received in the JSON payload defined in the previous step).
- The file name can be construted used dynamic content, too.
- The file content could be anything
If the folder doesn’t exists, a new folder will be created to save the file, so, with this workaround, our folder in SharePoint will be “Shared Documents\SAPByD\XXXX” for project “XXXX” in SAP ByD.
After folder creation, we can ask SharePoint to get folder metada using a new action:
Fill “Site Address” with your Sharpoint online site and File Identifier with the path to the new folder. In my case, see how I add “project” dynamic content to build the full folder path:
At this point, you can add a new action and create a shared link to the folder:
Configure the options for the shared link, and use “Itemid” from “Dynamic content”/”Get folder metadata”
To complete your flow, now you can add a “New step” with a response:
If you want to send back the link to your folder, you can include in the response body, the sharing link created in the previous step
Here you can see our final flow :
Calling flows from SAP ByDesign
Go to SAP Cloud Applications Studio and create a new solution.
Create a External Webservice Integration:
You need to create a REST web service, using the URL created in Microsoft Flow the HTTP Request of your flow:You can get HTTP POST URL from Microsoft Flow using “Copy” button. It will look something like this one:
Now, create the scenario in SAP Cloud Application Studio:
And then, go to SAP ByDesign and create a communication arrangement:
Use Authentication Method “User ID and Password”:
Go to “Edit Advanced Settings” and deactivate the “Use Basic Settings” flag
In Path you must add manually the part of the text in URL you get from Microsoft Flow the HTTP Request of your flow, starting from “/workflows”
Return to your new solution in SAP Cloud Application Studio.
Add a Business Object Extension to “Project” standard BO:
Add this code to Event-BeforeSave:
This code makes a call to the external REST service in Microsoft Flow.
In the “Body” you can see how we build a JSON payload using the ProjectID.content.
You need to change ScenarioName and ServiceName if you use different names.
Activate your solution!
Test your integration process
- Creation of a new project in SAP ByDesign
- Your PDI solution must send an HTTP request to your Microsoft Flow
- The request triggers the new folder creation in your SharePoint online
Go to SAP ByDesign and create a new project:
If all it’s ok, a new folder will be created in your SharePoint:
You can use this procedure to create more complex integration scenarios.
If you want to use SharePoint REST Service directly to avoid Microsoft Flow: