SAP MDG · WORKFLOWS

How do I implement dynamic agent selection for supplier bank update workflow in SAP MDG?

Use a custom dynamic agent class that implements IF_USMD_SSW_DYNAMIC_AGT_SELECT and derive company codes from the BP change request, then filter the IAM approver list by company code, remove the request creator, and return the user-agent group for the workflow step.

Use a custom dynamic agent class that implements IF_USMD_SSW_DYNAMIC_AGT_SELECT and derive company codes from the BP change request, then filter the IAM approver list by company code, remove the request creator, and return the user-agent group for the workflow step.

Dynamic agent selection for supplier bank updates in SAP MDG is typically implemented in a custom class that implements IF_USMD_SSW_DYNAMIC_AGT_SELECT. The supplied example class ZCL_MDG_DYN_AGNT_SUP_BANK_UPD reads the BP change request, derives company codes, filters the approver list by those company codes, removes the requester, and passes the resulting user agents back to the workflow step.

Process flow

  1. Implement a custom class that implements IF_USMD_SSW_DYNAMIC_AGT_SELECT.
  2. Read USMD120C to get the current change request creator and context.
  3. Create a model instance with CL_USMD_MODEL_EXT=>GET_INSTANCE for model BP.
  4. Read BP request data and derive company codes from BP_COMPNY or the bank UIBB field.
  5. Call your approver retrieval source such as ZCL_MDG_WF_APPROVERS_RETRIEVAL=>GET_APPROVERS.
  6. Filter the approvers by company code or REGION_ORG.
  7. Remove the requester from the final agent list.
  8. Populate CT_USER_AGENT_GROUP and clear CT_NON_USER_AGENT_GROUP when the step is a dialog approval step.

Referenced tables

ObjectPurpose
USMD120CChange request header data, including creator and request context.
BUT020Used in the sample to derive the BP address number from the business partner.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example

Exact relevant implementation excerpt from the knowledge document.

1class ZCL_MDG_DYN_AGNT_SUP_BANK_UPD definition 2 public 3 final 4 create public . 5 6public section. 7 8 interfaces IF_BADI_INTERFACE . 9 interfaces IF_USMD_SSW_DYNAMIC_AGT_SELECT . 10 11 class-methods GET_COMPANY_CODE 12 importing 13 !IV_CR_NUMBER type USMD_CREQUEST 14 !IV_SERVICE_NAME type USMD_SERVICE_NAME optional 15 !ET_MESSAGE type USMD_T_MESSAGE optional 16 exporting 17 !ET_COMPANY_CODE type ZMDG_TY_COMPANY_CODES . 18protected section. 19private section. 20 21 class-methods READ_CR_OBJECTLIST 22 importing 23 !IO_MODEL type ref to IF_USMD_MODEL_EXT 24 !IV_CREQUEST_ID type USMD_CREQUEST 25 returning 26 value(RT_OBJLIST) type USMD_T_CREQUEST_ENTITY . 27ENDCLASS. 28 29 30 31CLASS ZCL_MDG_DYN_AGNT_SUP_BANK_UPD IMPLEMENTATION. 32 33 34 method get_company_code. 35 constants: lc_model type usmd_model value 'BP'. 36 data: go_mdg_conv type ref to cl_usmd_conv_som_gov_api, 37 go_som_gov_api_error type ref to cx_usmd_conv_som_gov_api, 38 go_gov_api_error type ref to cx_usmd_gov_api, 39 go_cons_error type ref to cx_usmd_app_context_cons_error, 40 lt_sel type usmd_ts_sel, 41 lt_sel_cp type usmd_ts_sel, 42 ls_sel type usmd_s_sel, 43 lt_entities type usmd_t_crequest_entity, 44 lv_partner type bu_partner, 45 lv_suppl_bp type bu_partner, 46 lt_company_codes type zmdg_ty_company_codes, 47 ls_company_codes type zmdg_s_company_codes, 48 lr_model type ref to if_usmd_model_ext, 49 lt_entity_data type usmd_ts_data_entity, 50 lv_bp_header type /mdgbp/_s_bp_pp_bp_header, 51 lv_bp_centrl type /mdgbp/_s_bp_pp_bp_centrl, 52 lt_entity_bp_centrl type table of /mdgbp/_s_bp_pp_bp_centrl, 53 ls_zsub_bp_centrl type /mdgbp/_s_bp_pp_bp_centrl, 54 lt_bp_role type zmdg_tt_bp_es_bp_role, 55 lt_bp_idnum type zmdg_tt_bp_idnum, 56 lt_address type zmdg_tt_address, 57 ls_entity_bpvengen type /mdgbpx/_s_bp_pp_bp_vengen, 58 lt_entity_bpvengen type table of /mdgbpx/_s_bp_pp_bp_vengen, 59 lt_bp_vengen type table of /mdgbpx/_s_bp_pp_bp_vengen, 60 ls_entity_bpcentrl type /mdgbp/_s_bp_pp_bp_centrl, 61 lt_zsub_bp_cus_cc type table of /mdgbpx/_s_bp_pp_bp_compny, " zmdg_tt_bp_cus_cc, 62 ls_bp_cus_cc type /mdgbpx/_s_bp_pp_bp_cus_cc, 63 lt_bp_cus_cc type table of /mdgbpx/_s_bp_pp_bp_cus_cc, 64 lt_entity_bp_compny type table of /mdgbpx/_s_bp_pp_bp_compny, 65 ls_entity_bp_cus_cc type /mdgbpx/_s_bp_pp_bp_compny, 66 ls_entity_data type usmd_sx_data_entity, 67 lo_crequest type ref to if_usmd_crequest_api, 68 ls_crequest type usmd_s_crequest, 69 lv_message type usmd_s_message. 70 71 field-symbols : <fs_lt_entity> type sorted table, 72 <fs_ls_entity> type any, 73 <fs_lt_zsub_ad_postal> type any table. 74 75 call method cl_usmd_crequest_api=>get_instance 76 exporting 77 iv_crequest = iv_cr_number 78 importing 79 re_inst_crequest_api = lo_crequest. 80 81 call method lo_crequest->read_crequest 82 importing 83 es_crequest = ls_crequest. 84 85 "Get read-only access to model data 86 call method cl_usmd_model_ext=>get_instance 87 exporting 88 i_usmd_model = lc_model 89 importing 90 eo_instance = lr_model. 91 92 if lr_model is bound. 93**** prepare selection 94 ls_sel-sign = usmd0_cs_ra-sign_i. 95 ls_sel-option = usmd0_cs_ra-option_eq. 96 ls_sel-fieldname = usmd0_cs_fld-crequest. 97 ls_sel-low = iv_cr_number. 98 insert ls_sel into table lt_sel. 99 call method lr_model->read_char_value 100 exporting 101 i_fieldname = usmd0_cs_fld-crequest 102 it_sel = lt_sel 103 importing 104 et_data = lt_entities. 105 106*******Read just the Business partner ignoring the contacts if applicable. 107 loop at lt_entities assigning field-symbol(<fs_entity>) 108 where usmd_seqnr = '1' or usmd_seqnr = '2'. "#EC CI_SORTSEQ 109 ls_sel-fieldname = <fs_entity>-usmd_entity_obj. 110 ls_sel-low = <fs_entity>-usmd_value. 111 insert ls_sel into table lt_sel. 112 if <fs_entity>-usmd_entity_obj = 'BP_HEADER' 113 and <fs_entity>-usmd_seqnr = '1'. 114 lv_suppl_bp = <fs_entity>-usmd_value. 115 endif. 116 endloop. 117 118 call function 'CONVERSION_EXIT_ALPHA_INPUT' 119 exporting 120 input = lv_suppl_bp

The remaining configuration, implementation details, and testing guidance continue from this answer more…

Related questions and keywords

Alternative questions

  • How is supplier bank workflow routing implemented with IF_USMD_SSW_DYNAMIC_AGT_SELECT?
  • How can I filter MDG approvers by company code for supplier bank updates?
  • How do I remove the request creator from the approver list in MDG dynamic agent selection?

Possible questions

  • How do I implement dynamic agent selection for supplier bank update workflow in SAP MDG?
  • How is supplier bank workflow routing implemented with IF_USMD_SSW_DYNAMIC_AGT_SELECT?
  • How can I filter MDG approvers by company code for supplier bank updates?
  • Which structures and method pattern are used for MDG dynamic agent selection?
  • How do I remove the request creator from the approver list in SAP MDG workflow?

Keywords

SAP MDGdynamic agentsupplier bank updateIF_USMD_SSW_DYNAMIC_AGT_SELECTUSMD_SSW_DYNAMIC_AGENT_SELECTUSMD120CUSMD_SSW_SYSTEM_METHOD_CALLERcompany codeapprover filteringBP model