
SAP Flexible Workflow has become the standard workflow approach within S/4HANA. Its power lies in the capability of defining the workflow rules through the Manage Workflow apps, which moves the definition into the hands of business analysts instead of developers.
With Flexible Workflow, the integration points change, as we can’t simply add a step into the workflow definition. Instead, the activity is defined within the workflow ‘scenario’ and then the workflow step definition is configured in the Manage Workflow app.
I’ve been investigating how to extend a SAP Flexible Workflow into Microsoft Teams using Looply, such the processes can be approved without managers leaving Teams.
My requirements are:
I chose the scenario of Purchase Requisition approval, in an S/4HANA 2020 system, working with scenario WS02000458 – Overall Release of Purchase Requisition.
I have since realized that in S/4HANA 2023 there are more activities available to support resubmission of rejected documents. In the 2020 version a rejected document is basically cancelled, so a user would need to start again rather than edit and resubmit.
I considered two possible approaches:
I don’t like option 1 because it relies on a job running constantly, so I focused on option 2.
I also needed to consider how the card would be updated if the workflow was actioned within SAP: So just looking for new workitems for a task wasn’t enough, I would need also to look for actions taken for a particular task.
Option 2 provides the solution to trigger the initial card and any updates: Once the task to approve or reject a workitem is completed, then the workflow should continue to a final step to send updates to Teams.
This leads to a 3-step approach, where we trigger the card in step 1, and send updates to the card in step 3.
The problem with this approach is that the Agent determination – the part where we figure out who the approver is – has to be executed on Step 2. We can’t do it on step 1 because that’s a background task. Also, we can’t trigger the card after step 2, because the workflow waits for user action on that step.
This means that, irritatingly, the point at which we can trigger the creation of the card in Teams is before the system has determined the approver. Nevertheless, after some head-scratching, I found this to be best approach!
We have to configure a workflow in Looply too, in order to control when cards are sent, how they are updated and when calls are made back to SAP.
This is a visual drag-and-drop task, with some data mapping behind each step.
Since we can reach back to S/4HANA at any point in the Looply workflow, we can make a call to read the workflow agents before we send the Adaptive Card to the approver.
By the time the step is executed in Looply, the SAP Flexible Workflow has moved on to the second step and determined the approver, so that’s available to us in the workflow container.
If, on the off chance that the Looply step is executed first, we can add a simple check to make sure that the Approver is determined before we continue.
After the Approver Card is created, then Looply awaits a response.
So at this point you have the SAP workflow waiting for a response, and the Looply workflow waiting for a response.
The Looply workflow has 2 branches – one for when the response comes from Teams, and the other for when the response comes from SAP.
When action is taken in SAP, then the ‘External Response’ branch is taken, so we can update the Cards for the Approver and Requestor, and complete the flow.
When the action is taken in Teams, then a second call must be made to SAP to pass in the action and other data (such as the decision comment) and to push the SAP Workflow on to the next step.
This means that there is a total of 4 integration points; 2 from SAP to Looply, and 2 from Looply to SAP.
There is a control table in the SAP IMG, (part of the Looply Add-on for S/4HANA or Business Suite) to derive what custom function should be run for each scenario.
The key logic for these functions is:
Trigger Looply Function:
Get Approver Function:
Resume Looply Function (after SAP action):
Update SAP Function (after Teams action):
This just leaves the design of the Adaptive card, which is also done in Looply, using a visual designer. Fields are mapped to data nodes, and conditional logic can be added to control presence.
This approach delivers on all 5 requirements, and the only development required was 4 small ABAP functions. Understanding of SAP workflow is the main skill required: No expertise in Teams or integration or any other technology was needed. I'm not suggesting that this is easy, because we've achieved quite deep integration into the SAP workflow. But I can't think that there is any easier approach with any other toolset.
Here is the resulting notification to the requestor, one item processed in Teams and the other one in Fiori My Inbox.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
3 | |
3 | |
3 | |
3 | |
2 | |
2 | |
2 | |
2 | |
2 | |
2 |