SAP MDG · WORKFLOWS
How do I implement dynamic agent determination for BP change requests in SAP MDG, including four-eye logic and role-to-user resolution?
Implement the BP workflow agent logic in BAdI `USMD_SSW_DYNAMIC_AGENT_SELECT` and resolve the responsible roles to users via `AGR_USERS`, while excluding both the requestor and the last processor for two-way four-eye control.
Implement the BP workflow agent logic in BAdI `USMD_SSW_DYNAMIC_AGENT_SELECT` and resolve the responsible roles to users via `AGR_USERS`, while excluding both the requestor and the last processor for two-way four-eye control.
BP dynamic agent determination in MDG is implemented in BAdI `USMD_SSW_DYNAMIC_AGENT_SELECT`. The BP sample shows the core pattern: read the workflow context, resolve roles to users via `AGR_USERS`, apply two-way four-eye control by excluding the requestor and the last processor, and then build `USMD_T_USER_AGENT_GROUP` with the correct step type for the current CR/service.
Process flow
- Register BAdI `
USMD_SSW_DYNAMIC_AGENT_SELECT` for the BP model - Read the CR context from `cl_usmd_app_context`
- Determine the routing scenario and service branch
- Resolve business roles for the BP step
- Expand roles to users using `AGR_USERS`
- Read the last processor from the workflow container element `PROCESSOR`
- Exclude requestor and last processor from the agent list
- Populate `
USMD_T_USER_AGENT_GROUP` and return it
Workflow service routing via `iv_service_name` in `GET_DYNAMIC_AGENTS`
Route BP scenarios to the correct approver logic
Referenced tables
| Object | Purpose |
|---|---|
AGR_USERS | Standard role-to-user assignment table used to expand roles into runtime users |
USMD_T_USER_AGENT_GROUP | Export structure/table used to return workflow agents for MDG |
USMD4_T_SWR_CONT | Workflow container table used to read the `PROCESSOR` value from the latest work item |
SWR_WIHDR_TABLE | Dependent work item header table used to find the latest `W` work item |
ILLUSTRATIVE ABAP SAMPLE
Source ABAP example: flexible_user_determination_using_BAdl_USMD_SSW_DYNAMIC_AGENT.abap
Exact relevant implementation excerpt from the knowledge document set.
1*---------------------------------------------------------------------*
2* Flexible User Determination Using BAdI USMD_SSW_DYNAMIC_AGENT_SELECT
3*---------------------------------------------------------------------*
4
5* Enhancement Spot
6* USMD_SSW_SERVICE_PROCESSOR
7
8* Interface Method
9* IF_USMD_SSW_DYNAMIC_AGT_SELECT~GET_DYNAMIC_AGENTS
10
11* Example implementation referenced by the guide:
12* MDG_BS_MAT_SELECT_AGENT
13
14* Implementing class:
15* CL_MDG_BS_MAT_SELECT_AGENT
16
17* Private helper method:
18* READ_MATERIAL
19
20* NOTE:
21* The PDF does NOT contain the implementation source code.
22* It only references the above enhancement, class and methods.
23* Therefore no additional ABAP source is present in the document.The remaining configuration, implementation details, and testing guidance continue from this answer more…
Related questions and keywords
Alternative questions
- How do I route BP change requests to the right approvers in MDG workflow?
- Which BAdI is used for BP dynamic agent determination in MDG?
- How can I exclude the requestor and last processor in BP workflow agent selection?
Possible questions
- How to implement BP dynamic agent determination in SAP MDG workflow
- How to route BP change requests to approvers dynamically in MDG
- How to apply four-eye control in MDG BP agent determination
- How to resolve BP approver roles to users in MDG
- Which table is used for BP role-to-user agent expansion in MDG