Welcome back to our new blog series, our previous blog series delved into the intricacies of dynamic sequential approval workflows.
In this two-part series, my colleague @Adwait_Fadnavis and I will explore some very critical business workflow requirements in detail using SAP Build Process Automation.
Throughout this blog series, we will delve into the following critical business requirements:
Part 1 - Current Blog :Mastering Complex SBPA Approvals : A Deep Dive into Wait Steps, Script Tasks, and API Integrations
Part 2 : Demonstration with Complete end to end testing
We will demonstrate how to use various SAP Build Process Automation tools to solve real-time challenges effectively.
This blog post addresses this complex requirement with detailed step-by-step instructions. You'll learn how to ensure workflows advance smoothly, even with approval condition utilizing various innovative latest features such as: Wait Step with API Triggering , Workflow Context update via API etc.
Business Context and Problem Statement
While working on multiple SAP Build Process Automation projects, we have faced situations where workflows only proceed if all departments or approvers approve them unanimously.
If any approver rejects the proposal, the entire workflow is rejected . This creates a need for a parallel approval process, adhering to an "all-or-nothing" requirement, which SAP's standard solutions do not support.
In a below sample procurement workflow, the request is created and submitted. Both the Department Manager and Finance Department must approve it simultaneously. If either rejects, the workflow is terminated.
If both approve, the request goes to the Executive for final approval. The Executive's decision determines whether the request is processed or terminated.
In this process, we will create two workflows using SAP Build Process Automation’s Low Code/No Code approach.
Let’s refer to these as Workflow A (main workflow) and Workflow B.
Workflow A( Main Workflow): This is the main workflow, triggered with all input parameters, responsible for the overall business process flow.
Workflow B(Secondary Workflow): This workflow handles the approval task. It receives the Approval ID, total number of levels, and current level. If the final approval is granted, it triggers a wait step API in Workflow A to proceed to the next level. If more approvals are needed, it sends the Approval ID to the next level.
3. Script Task: This step determines the total number of approvals and the current approval level.
$.context.custom.doneapprovalcount = 0;
$.context.custom.currentcount = 0;
$.context.custom.subwfdefinationid = "Your Secondaray Workflow ID"; // replace with your secondary workflow id
$.context.custom.totalapprovalcount = $.context.decision_getAppprovers_1.Approvers.length;
$.context.custom.triggeredsubprocessids = [];
Trigger from Workflow A : Workflow B starts when Workflow A reaches a certain point to manage approval tasks separately and in parallel to the main workflow.
$.context.custom.approvedcount = $.context.action_get_getV1WorkflowInstancesWorkflowInstanceIdContext_6.result.custom.doneapprovalcount + 1;Regards,
SAP Mentor. SAP BTP Solution Architect
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 37 | |
| 32 | |
| 29 | |
| 28 | |
| 26 | |
| 25 | |
| 20 | |
| 14 | |
| 12 | |
| 11 |