It’s quite often required that the master data requestor may not be approver in the same master data process even when the requestor belongs to the org unit (or other PPOME object) for the approver role. (PPOME is the transaction the ERP user management.)

This solution approach explains a quick but efficient way to implement this requirement via the BAdI USMD_SSW_DYNAMIC_AGENT_SELECT of the rule-based workflow (RBW) in MDG.

The steps are:

1) Determine the PPOME object ID and object type, e.g. org unit and relevant ID. This object is in user agent group parameter of the BAdI method (details below).

2) Get all the user IDs out of the PPOME object.

3) Determine the orginal requester of the relevant MDG change request (CR).

4) Remove the user ID of original requestor out of the user ID list that has been gotten in step 2).

5) Put the remaining user IDs back to the user agent group of the BAdI method.

As a prerequisite please make sure that you have defined a service name for the RBW in the customizing:

SNAG-0005.png

This customizing table is also reachable via SM30 with view name V_USMD201C_SSW.

The service name have to be assigned to the relevant steps in the RBW-table “Single Value Decision Table”, e.g. DT_SINGLE_VAL_ZSU02002:

SNAG-0004.png

The service name is applied as a filter value for an implementation of BAdI USMD_SSW_DYNAMIC_AGENT_SELECT:

In runtime, when reaching the RBW step that has assigned the specified service name, MDG calls the method GET_DYNAMIC_AGENTS. This method has very handy parameters as in- and outbound. One of them is the CT_USER_AGENT_GROUP:

SNAG-0003.png

It is possible to get the object type and ID defined by RBW out of this parameter CT_USER_AGENT_GROUP. This is step 1) of the task list above.

Step 2) can be executed with the help of the function module «RH_STRUC_GET ». This module returns all users of an PPOME object, be it an org unit, position or other possible values. Here an example for getting the user IDs of an org unit:

SNAG-0007.png

Step 3 and 4: the determination of the original requester can be done via the MDG change request API or directly via a select statement on table USMD120C. The CR ID is in signature of method GET_DYNAMIC_AGENTS.

* get original requestor of CR    

SELECT usmd_created_by FROM usmd120c INTO TABLE lt_requestors WHERE usmd_crequest = iv_cr_number .     

READ TABLE lt_requestors INTO lv_requestor INDEX 1.

* remove the user ID of original requestor from workflow agents .

LOOP AT lt_users INTO ls_user.

        IF ls_user EQ lv_requestor.         

          lv_tabix = sy-tabix.         

          EXIT .

        ENDIF.    

ENDLOOP.     

DELETE lt_users INDEX lv_tabix .

And finally last step 5: write back the remaining list of users to the parameter CT_USER_AGENT_GROUP.

* move the user list except requestor user ID into target agent group

LOOP AT lt_users INTO ls_user.

     CLEAR: ls_user_agent.

     ls_user_agent-user_type  = ‘US’.  ” users without requester user ID

     ls_user_agent-user_value = ls_user.

     APPEND ls_user_agent TO ls_user_agent_group-user_agent.

ENDLOOP.      

APPEND ls_user_agent_group TO ct_user_agent_group.

Thank you to Adrian Branka who gave me the decisive ideas for this quick but efficient implementation of the 4-eyes-principle.

To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply