SAP MDG · WORKFLOWS
How do I implement the SAP MDG parallel result handler BAdI to merge parallel workflow branches?
Implement BAdI USMD_SSW_PARA_RSLT_HANDLER in class ZCL_MDG_CUS_PARA_HANDLER, read IT_STEP_ACTION, and return a merged action/step. The supplied pattern is simple: clear outputs, loop through the parallel branch actions, and if any branch has reject action '06' then set EV_MERGE_ACTION to '06' and EV_MERGE_STEP to '11'; otherwise set EV_MERGE_ACTION to '05' and EV_MERGE_STEP to '11'.
Implement BAdI USMD_SSW_PARA_RSLT_HANDLER in class ZCL_MDG_CUS_PARA_HANDLER, read IT_STEP_ACTION, and return a merged action/step. The supplied pattern is simple: clear outputs, loop through the parallel branch actions, and if any branch has reject action '06' then set EV_MERGE_ACTION to '06' and EV_MERGE_STEP to '11'; otherwise set EV_MERGE_ACTION to '05' and EV_MERGE_STEP to '11'.
Implement the SAP MDG parallel result handler in `USMD_SSW_PARA_RSLT_HANDLER` / `HANDLE_PARALLEL_RESULT` and base the merge on `IT_STEP_ACTION`. The supplied customer class `ZCL_MDG_CUS_PARA_HANDLER` uses a clear precedence rule: if any parallel branch returns action `06`, the merged result is rejection; otherwise the merged result is approval.
Process flow
- Create or copy a BAdI implementation for `
USMD_SSW_PARA_RSLT_HANDLER`. - Implement `IF_USMD_SSW_PARA_RSLT_HANDLER` in the class.
- Implement method `
HANDLE_PARALLEL_RESULT`. - Read the branch results from `IT_STEP_ACTION`.
- Check each branch action for the reject value.
- If any reject is found, set `EV_MERGE_ACTION` and `EV_MERGE_STEP` and return immediately.
- If no reject is found, set the approve merge action and merge step.
- Clear or populate `ET_MESSAGE` as required by your scenario.
Referenced tables
| Object | Purpose |
|---|---|
IT_STEP_ACTION | Input table containing the individual results from the parallel workflow branches. |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example
Exact relevant implementation excerpt from the knowledge document.
1class ZCL_MDG_CUS_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_MDG_CUS_PARA_HANDLER IMPLEMENTATION.
17
18
19 METHOD if_usmd_ssw_para_rslt_handler~handle_parallel_result.
20
21 CONSTANTS: lc_reject TYPE usmd_crequest_action VALUE '06'.
22 CONSTANTS: lc_mergestep TYPE usmd_crequest_appstep VALUE '11'.
23 CONSTANTS: lc_approve TYPE usmd_crequest_action VALUE '05'.
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 one 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, none rejects, the result is to approve
37 ev_merge_action = lc_approve.
38 ev_merge_step = lc_mergestep.
39 ENDMETHOD.
40ENDCLASS.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I build the logic for
USMD_SSW_PARA_RSLT_HANDLER? - What should
HANDLE_PARALLEL_RESULTreturn in an MDG parallel workflow? - How do I make one reject win in SAP MDG parallel approval branches?
Possible questions
- What is the BAdI name for parallel workflow result handling in SAP MDG?
- Which method merges the parallel branch results in MDG?
- How do I configure the service name for a parallel result handler?
- What action codes are used in the sample implementation?
- What is the merge step in the sample class?