SAP MDG · WORKFLOWS
How do I implement SAP MDG parallel result handling in `USMD_SSW_PARA_RSLT_HANDLER` so that any reject overrides approval?
Implement `IF_USMD_SSW_PARA_RSLT_HANDLER~HANDLE_PARALLEL_RESULT` in BAdI `USMD_SSW_PARA_RSLT_HANDLER`. The common pattern is to loop over `IT_STEP_ACTION`, return `EV_MERGE_ACTION = '04'` if any branch rejected, otherwise set `EV_MERGE_ACTION = '03'`, and set `EV_MERGE_STEP` to the configured merge step.
Implement `IF_USMD_SSW_PARA_RSLT_HANDLER~HANDLE_PARALLEL_RESULT` in BAdI `USMD_SSW_PARA_RSLT_HANDLER`. The common pattern is to loop over `IT_STEP_ACTION`, return `EV_MERGE_ACTION = '04'` if any branch rejected, otherwise set `EV_MERGE_ACTION = '03'`, and set `EV_MERGE_STEP` to the configured merge step.
In SAP MDG, the parallel result handler BAdI consolidates the results of parallel workflow branches into one merged action. The supplied example `ZCL_SUP_CRE_PARA_HANDLER` uses a simple precedence rule: if any branch action in `IT_STEP_ACTION` is reject (`'04'`), the merged result is reject; otherwise it is approve (`'03'`). The merge step is set to `'02'`, and the method clears the output parameters before evaluating the branch actions.
Process flow
- Create or reuse a custom class that implements `IF_BADI_INTERFACE` and `IF_USMD_SSW_PARA_RSLT_HANDLER`.
- Implement method `IF_USMD_SSW_PARA_RSLT_HANDLER~
HANDLE_PARALLEL_RESULT`. - Declare typed constants for reject (`'04'`), approve (`'03'`), and the merge step (`'02'` in the example).
- Clear `EV_MERGE_ACTION`, `EV_MERGE_STEP`, and `ET_MESSAGE` at the start of the method.
- Loop over `IT_STEP_ACTION` and check `LS_STEP_ACTION-ACTION`.
- If any action equals reject, assign reject to `EV_MERGE_ACTION`, assign the merge step to `EV_MERGE_STEP`, and `RETURN`.
- If no reject is found, assign approve to `EV_MERGE_ACTION` and the merge step to `EV_MERGE_STEP`.
- Activate the class and assign the BAdI implementation in your MDG workflow scenario.
Referenced tables
| Object | Purpose |
|---|---|
USMD_SSW_PARA_RSLT_HANDLER | BAdI that aggregates parallel workflow branch results into one merged result. |
IT_STEP_ACTION | Input table containing the individual branch actions to be evaluated by the merge handler. |
EV_MERGE_ACTION | Output field for the final merged workflow action. |
EV_MERGE_STEP | Output field for the workflow step to continue from after the merge. |
ET_MESSAGE | Output message table; the supplied examples clear it but do not populate it. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1class ZCL_SUP_CRE_PARA_HANDLER 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_SUP_CRE_PARA_HANDLER IMPLEMENTATION.
17
18
19METHOD if_usmd_ssw_para_rslt_handler~handle_parallel_result.
20
21 CONSTANTS: lc_reject TYPE usmd_crequest_action VALUE '04'.
22 CONSTANTS: lc_mergestep TYPE usmd_crequest_appstep VALUE '02'.
23 CONSTANTS: lc_approve TYPE usmd_crequest_action VALUE '03'.
24
25 DATA: ls_step_action TYPE usmd_s_step_action.
26
27 CLEAR: ev_merge_action, ev_merge_step, et_message.
28* Check whether at least on steward rejects the request. The result is to reject.
29 LOOP AT it_step_action INTO ls_step_action.
30 IF ls_step_action-action = lc_reject.
31 ev_merge_action = lc_reject.
32 ev_merge_step = lc_mergestep.
33 RETURN.
34 ENDIF.
35 ENDLOOP.
36 " in this case, no steward rejects, the result is to approve
37 ev_merge_action = lc_approve.
38 ev_merge_step = lc_mergestep.
39ENDMETHOD.
40ENDCLASS.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I code `IF_USMD_SSW_PARA_RSLT_HANDLER~
HANDLE_PARALLEL_RESULT` in SAP MDG? - How do I merge parallel workflow branch results in SAP MDG?
- How do I make an MDG parallel workflow reject if any approver rejects?
Possible questions
- How do I implement SAP MDG parallel result handling in `
USMD_SSW_PARA_RSLT_HANDLER` so that any reject overrides approval? - Which BAdI controls the merged result of parallel MDG workflow branches?
- How do I code `IF_USMD_SSW_PARA_RSLT_HANDLER~
HANDLE_PARALLEL_RESULT`? - How do I make an MDG parallel workflow reject if any approver rejects?
- What are the standard action values used in MDG parallel workflow result handling?