SAP MDG · WORKFLOWS
How do I implement dynamic agent determination for an MDG Material workflow step using USMD_SSW_DYNAMIC_AGENT_SELECT?
Implement the MDG BAdI `USMD_SSW_DYNAMIC_AGENT_SELECT` with a material-specific service gate. In the MM sample, `ZCL_BADI_MM_DYNAMIC_AGENT` routes `ZMDG_MM_DYN_AGT_MATERIAL` to role determination using material data, plant-to-company-code mapping via `T001K`, and the custom table `ZMDG_C_MM_AGENT`; it also supports `ZMDG_MM_DYN_PREV_APPR` for rejection routing to the previous approver.
Implement the MDG BAdI `USMD_SSW_DYNAMIC_AGENT_SELECT` with a material-specific service gate. In the MM sample, `ZCL_BADI_MM_DYNAMIC_AGENT` routes `ZMDG_MM_DYN_AGT_MATERIAL` to role determination using material data, plant-to-company-code mapping via `T001K`, and the custom table `ZMDG_C_MM_AGENT`; it also supports `ZMDG_MM_DYN_PREV_APPR` for rejection routing to the previous approver.
Implement MDG Material dynamic agent determination in `USMD_SSW_DYNAMIC_AGENT_SELECT` with a model filter for `MM`. The sample class `ZCL_BADI_MM_DYNAMIC_AGENT` shows two branches: `ZMDG_MM_DYN_AGT_MATERIAL` for role determination from material data, and `ZMDG_MM_DYN_PREV_APPR` for routing back to the previous approver on rejection. The material branch reads inactive CR entity data, extracts `SPART` and `WERKS`, converts plant to company code using `T001K`, and then looks up the responsible role in `ZMDG_C_MM_AGENT`.
Process flow
- In `SE19`, create or edit an implementation of BAdI `
USMD_SSW_DYNAMIC_AGENT_SELECT` and set the filter to MDG model `MM`. - Implement or reuse class `ZCL_BADI_MM_DYNAMIC_AGENT`.
- In `GET_DYNAMIC_AGENTS`, branch on `iv_service_name`.
- For `ZMDG_MM_DYN_AGT_MATERIAL`, call the material-determination method.
- Inside the determination method, read the CR header, determine `CRTYPE`, and read inactive entity data with `READ_ENTITY_DATA`.
- Extract `SPART` and `WERKS` from the material data.
- Convert `WERKS` to `BUKRS` using `T001K`.
- Select matching rows from `ZMDG_C_MM_AGENT` using `BUKRS`, `CRTYPE`, `CRSTEP`, and `SPART`, with `'*'` as wildcard support.`,`Fill `ct_user_agent_group` with agent type `AG` and the selected role values.`,
Referenced tables
| Object | Purpose |
|---|---|
ZMDG_C_MM_AGENT | Custom MM agent-determination table keyed by `BUKRS`, `CRTYPE`, `CRSTEP`, and `SPART`, returning role values |
T001K | Standard valuation-area to company-code mapping used to derive `BUKRS` from plant `WERKS` |
AGR_USERS | Standard role-to-user mapping used when user resolution is needed after role determination |
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 MDG Material change requests to agents dynamically?
- How do I implement previous-approver routing in MDG Material workflow?
- Which class and tables are used for MM dynamic agent determination in MDG?
Possible questions
- How do I implement dynamic agent determination for an MDG Material workflow step?
- How do I route MDG Material change requests to agents dynamically?
- How do I implement previous-approver routing in MDG Material workflow?
- Which class and tables are used for MM dynamic agent determination in MDG?
- What service name is used for material agent determination?