SAP MDG · WORKFLOWS

How do I implement SAP MDG parallel workflow result merging in BAdI USMD_SSW_PARA_RSLT_HANDLER?

Use BAdI USMD_SSW_PARA_RSLT_HANDLER and implement HANDLE_PARALLEL_RESULT to read IT_STEP_ACTION, apply your precedence rule, and return one merged workflow step and action. The supplied pattern is usually: if any parallel branch rejects, return Reject; otherwise return Approve.

Use BAdI USMD_SSW_PARA_RSLT_HANDLER and implement HANDLE_PARALLEL_RESULT to read IT_STEP_ACTION, apply your precedence rule, and return one merged workflow step and action. The supplied pattern is usually: if any parallel branch rejects, return Reject; otherwise return Approve.

SAP MDG merges parallel approval branches through BAdI `USMD_SSW_PARA_RSLT_HANDLER` with method `HANDLE_PARALLEL_RESULT`. The handler receives the parallel branch results in `IT_STEP_ACTION`, decides the final merged outcome, and returns the workflow step and action the process should continue with. In the supplied pattern, the most common rule is simple: if any branch rejects, the merged result is Reject; otherwise it is Approve.

Process flow

  1. Implement BAdI `USMD_SSW_PARA_RSLT_HANDLER`.
  2. Implement method `HANDLE_PARALLEL_RESULT` in a handler class.
  3. Declare `IF_BADI_INTERFACE` and `IF_USMD_SSW_PARA_RSLT_HANDLER` in the class.
  4. Read the parallel branch outcomes from `IT_STEP_ACTION`.
  5. Apply the business precedence rule, such as Reject over Approve.
  6. Set `EV_MERGE_STEP` and `EV_MERGE_ACTION`.
  7. Clear `ET_MESSAGE` if you do not return messages.
  8. Optionally filter by `IV_SERVICE_NAME` if one implementation serves multiple services.

Referenced tables

ObjectPurpose
`IT_STEP_ACTION`Input table containing the results/actions from the parallel workflow branches.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example: ZCL_MDG_CUS_PARA_HANDLER.clas.abap

Exact relevant implementation excerpt from the knowledge document set.

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

  • Which BAdI merges parallel workflow results in SAP MDG?
  • How do I combine parallel approval outcomes into one MDG workflow result?
  • What is the implementation pattern for HANDLE_PARALLEL_RESULT?

Possible questions

  • How can I create parallel workflow tasks in SAP MDG?
  • How do I merge two parallel approval work items?
  • How does MDG handle parallel approvers?
  • What BAdI merges parallel workflow results?
  • How does HANDLE_PARALLEL_RESULT decide the final action?

Keywords

SAP MDGparallel workflowparallel approvalworkflow mergeUSMD_SSW_PARA_RSLT_HANDLERIF_USMD_SSW_PARA_RSLT_HANDLERHANDLE_PARALLEL_RESULTIT_STEP_ACTIONEV_MERGE_STEPEV_MERGE_ACTIONET_MESSAGEIV_SERVICE_NAME