Skip to Content
Technical Articles
Author's profile photo changhong chon

MDG Rule Based Workflow – Parallel rejection immediately

#0 Introduction

There is a parallel workflow in which a workflow is sent to multiple departments at the same time, each department takes an action, and when the action is finished, the result is merged to determine the next flow. How to set up this flow is detailed in this document.

 

#1 Requirement

In a situation where a parallel workflow is implemented, when one department takes a rejection action, we want to immediately make a rejection decision without waiting for the decision of the other parallel side.

 

#2 Solution

First, separate the subsequent step approve action and reject action on the BRF+ table. When user choose approval, condition 99 selected and process pattern 99 (Close Sub workflow) will be executed.  Otherwise, When the rejection chosen it should calls the system method before terminating the sub-workflow. The system method terminates the parallel sub-workflow on the other side and closes the dialog step to bring the flow to the merge step.

 

#3 Sample

The basic implementation is the same as this how-to document. When one department of the parallel step takes a reject action, the workflow log is as follows. A dialogs step and a sub-workflow for the other parallel division remain.

You just do call the system method and close the remaining two work items in that method.

The BRF decision table is as follows. In the case of approval, the sub-workflow ends as it is, but in the case of rejection, the system method is set to be called.

 

To get work item numbers in method, I refer to this article. This would be a good reference. If you can get work item numbers, terminate the work item using WAPI FM as follows.

And I found that the action code was disappear at the merge step. Presumably because you call the system method twice, the action code disappears on the second call. That’s why I add the action code manually at the end.

When the implementation is finished, the flow moves as follows. When either side’s rejection action is executed, the other side’s flow is automatically terminated. You can see that the system workflow user exits the dialog step.

 

#4 Conclusion

In this way, you can return the flow to the requestor to modify the data without waiting for an action from another department. If one department approves and the remaining department rejects it, the flow works without any problem.

Assigned Tags

      3 Comments
      You must be Logged on to comment or reply to a post.
      Author's profile photo Wisam Chahoud
      Wisam Chahoud

      Nice Blog!

      Thanks a lot for sharing. I have something similar.

      *        cv_merge_type = 'B'.
      *        cv_merge_param = 'YMDG_MERGE_PARA'.
      
              LOOP AT lt_accwis ASSIGNING FIELD-SYMBOL(<fs_wi>) WHERE action = ''.
                CALL FUNCTION 'SAP_WAPI_WORKITEM_COMPLETE'
                  EXPORTING
                    WORKITEM_ID = <FS_WI>-WIID
                    ACTUAL_AGENT                    = SY-UNAME
                    LANGUAGE    = SY-LANGU
                    SET_OBSOLET = ' '
                    DO_COMMIT   = 'X'
                    DO_CALLBACK_IN_BACKGROUND       = 'X'
      **              IFS_XML_CONTAINER               =
                    CHECK_INBOX_RESTRICTION         = ' '
      **              IMPORTING
      **             RETURN_CODE =
      **             NEW_STATUS  =
      **           TABLES
      **             SIMPLE_CONTAINER                =
      **             MESSAGE_LINES                   =
      **             MESSAGE_STRUCT                  =
      *            .
      
               CALL METHOD lo_service->complete_crequest_wfstep(
                    EXPORTING
                    io_model    = lo_cr_model
                    if_ignore_globals = ld_if_ignore_globals
                    id_wi_id    = <fs_wi>-wiid
                    id_crequest = iv_cr_number
                    id_action   = '04'
                  IMPORTING
                    et_message  = lt_message ).
      
              ENDLOOP.
      
            ENDIF.
          ENDIF.
      
      Author's profile photo changhong chon
      changhong chon
      Blog Post Author

      Thanks for share your code! I guess that the method complete_crequest_wfstep has the same effect as process pattern number 99.

      Author's profile photo Wisam Chahoud
      Wisam Chahoud

      Yes!