SAP MDG · WORKFLOWS
How do I implement the SAP MDG parallel result handler BAdI to merge parallel workflow branch outcomes?
Implement BAdI `USMD_SSW_PARA_RSLT_HANDLER` in method `IF_USMD_SSW_PARA_RSLT_HANDLER~HANDLE_PARALLEL_RESULT` to evaluate `IT_STEP_ACTION` and return a single merged result. The supplied pattern is: if any parallel branch has action `06` (send for revision), return merge action `06`; otherwise return action `03` (approve), with merge step `D1`.
Implement BAdI `USMD_SSW_PARA_RSLT_HANDLER` in method `IF_USMD_SSW_PARA_RSLT_HANDLER~HANDLE_PARALLEL_RESULT` to evaluate `IT_STEP_ACTION` and return a single merged result. The supplied pattern is: if any parallel branch has action `06` (send for revision), return merge action `06`; otherwise return action `03` (approve), with merge step `D1`.
The SAP MDG parallel result handler BAdI is `USMD_SSW_PARA_RSLT_HANDLER`, implemented in `IF_USMD_SSW_PARA_RSLT_HANDLER~HANDLE_PARALLEL_RESULT`. In the supplied example, the method clears the outputs, loops through `IT_STEP_ACTION`, and applies a simple business rule: if any parallel branch has action `06` (send for revision), the merged result becomes `06`; otherwise the workflow is merged as approved with action `03`. The merge step used in the example is `D1`.
Process flow
- Implement BAdI `
USMD_SSW_PARA_RSLT_HANDLER` - Implement method `IF_USMD_SSW_PARA_RSLT_HANDLER~
HANDLE_PARALLEL_RESULT` - Clear `EV_MERGE_ACTION`, `EV_MERGE_STEP`, and `ET_MESSAGE`
- Loop at `IT_STEP_ACTION`
- If any action equals `06`, set merge action to `06`
- Set merge step to `D1`
- Otherwise set merge action to `03` and merge step to `D1`
- Activate the class and enhancement implementation
Referenced tables
| Object | Purpose |
|---|---|
IT_STEP_ACTION | Input table containing the actions returned by parallel workflow branches |
ET_MESSAGE | Output message table returned by `HANDLE_PARALLEL_RESULT` |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1class ZCL_MDG_CUST_BI_MERGE_BADI definition
2 public
3 final
4 create public .
5
6public section.
7
8 interfaces IF_BADI_INTERFACE .
9 interfaces IF_USMD_SSW_PARA_RSLT_HANDLER .
10protected section.
11private section.
12ENDCLASS.
13
14
15
16CLASS ZCL_MDG_CUST_BI_MERGE_BADI IMPLEMENTATION.
17
18
19 method if_usmd_ssw_para_rslt_handler~handle_parallel_result.
20 constants: lc_reject type usmd_crequest_action value '06'. " send for revision
21 constants: lc_mergestep type usmd_crequest_appstep value 'D1'. " merge step
22 constants: lc_approve type usmd_crequest_action value '03'. "approve
23
24 data: ls_step_action type usmd_s_step_action.
25
26 clear: ev_merge_action, ev_merge_step, et_message.
27 loop at it_step_action into ls_step_action.
28 if ls_step_action-action = lc_reject.
29 ev_merge_action = lc_reject.
30 ev_merge_step = lc_mergestep.
31 return.
32 endif.
33 endloop.
34 ev_merge_action = lc_approve.
35 ev_merge_step = lc_mergestep.
36 endmethod.
37ENDCLASS.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- Which BAdI merges parallel workflow results in SAP MDG?
- How do I code
HANDLE_PARALLEL_RESULTfor MDG parallel approvals? - How does SAP MDG decide the final action after parallel workflow branches?
Possible questions
- What input does
HANDLE_PARALLEL_RESULTreceive? - Can the parallel result handler access the Change Request data?
- Where do I define the Service Name filter for the parallel result handler?
- What is the standard approval/reject merge pattern in MDG parallel workflow?
- How do I activate and test the BAdI implementation?