SAP MDG · WORKFLOWS
How do I implement dynamic agent determination in SAP MDG workflow with a BAdI, BRF+ service names, and four-eye control?
Implement BAdI `USMD_SSW_DYNAMIC_AGENT_SELECT` and gate `GET_DYNAMIC_AGENTS` by the BRF+ service name, then determine agents from your custom table, expand roles to users with `AGR_USERS`, and apply the four-eye principle. The sample for model `0G` shows routing for cost center, GL account, profit center, and activation-failure handling.
Implement BAdI `USMD_SSW_DYNAMIC_AGENT_SELECT` and gate `GET_DYNAMIC_AGENTS` by the BRF+ service name, then determine agents from your custom table, expand roles to users with `AGR_USERS`, and apply the four-eye principle. The sample for model `0G` shows routing for cost center, GL account, profit center, and activation-failure handling.
Use BAdI `USMD_SSW_DYNAMIC_AGENT_SELECT` for MDG dynamic agent determination. In `GET_DYNAMIC_AGENTS`, gate logic by `iv_service_name` such as `ZMDG_0G_DYNAMIC_AGNT_CC`, then read the CR data, look up the responsible role or user in your Z configuration table, and return the agent group to workflow. The sample class also shows four-eye filtering and activation-failure routing.
Process flow
- Create or identify the MDG workflow service name in BRF+ decision tables, for example `ZMDG_0G_DYNAMIC_AGNT_CC`.
- Implement `IF_USMD_SSW_DYNAMIC_AGT_SELECT` in a class and register it in `SE19` under `
USMD_SSW_DYNAMIC_AGENT_SELECT`. - Use the MDG data model filter for `0G` so the implementation is only called for that model.
- In `GET_DYNAMIC_AGENTS`, clear messages and check `iv_service_name` before processing.
- Read CR details and staging entity data to derive routing inputs such as company code.
- Select the responsible roles or users from a custom Z configuration table such as `ZMDG_C_AGENT_CC`.
- Populate `ct_user_agent_group` with user agents of type `AG` for roles or `US` for named users.
- Resolve roles to users through `AGR_USERS` when workflow needs concrete user IDs, then exclude the requestor for four-eye control.
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_C_AGENT_CC | Custom agent determination table for 0G cost center routing, keyed by `cr_type`, `cr_step`, and `comp_code`, returning `bus_role`. |
ZMDG_C_AGENT_GL | Custom agent determination table for 0G GL account routing, keyed by `cr_type`, `cr_step`, `comp_code`, and `zdiv`, returning `bus_role`. |
ZMDG_C_AGENT_PC | Custom agent determination table for 0G profit center routing, keyed by `cr_type`, `cr_step`, and `comp_code`, returning `bus_role`. |
ZMDG_C_DIV_BUKRS | Division mapping table from company code to `zdiv`. |
AGR_USERS | Standard SAP role-to-user assignment table used to expand business roles to user IDs on the current date. |
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 set up MDG dynamic agent determination for 0G/FI?
- Which BAdI is used for dynamic workflow agents in SAP MDG?
- How can I route activation failures to the last processor in MDG?
Possible questions
- What is the BAdI for dynamic agent determination in MDG?
- How do I map BRF+ service names to agent determination logic?
- How do I exclude the requestor from MDG workflow agents?
- How do I implement activation-failure routing in MDG?
- Which table stores role-to-user mapping in the sample?