SAP MDG · WORKFLOWS

How do I implement a synchronous system method in SAP MDG Rule-Based Workflow using `USMD_SSW_SYSTEM_METHOD_CALLER`?

Use BAdI `USMD_SSW_SYSTEM_METHOD_CALLER` in enhancement spot `USMD_SSW_SERVICE_PROCESSOR`, create a Service Name in Rule-Based Workflow, bind that Service Name in BRF+ to a non-user step with Process Pattern `02`, and implement `IF_USMD_SSW_SYST_METHOD_CALLER~CALL_SYSTEM_METHOD` to execute the ABAP logic for the current Change Request.

Use BAdI `USMD_SSW_SYSTEM_METHOD_CALLER` in enhancement spot `USMD_SSW_SERVICE_PROCESSOR`, create a Service Name in Rule-Based Workflow, bind that Service Name in BRF+ to a non-user step with Process Pattern `02`, and implement `IF_USMD_SSW_SYST_METHOD_CALLER~CALL_SYSTEM_METHOD` to execute the ABAP logic for the current Change Request.

SAP MDG Rule-Based Workflow supports synchronous automatic steps through BAdI `USMD_SSW_SYSTEM_METHOD_CALLER` in enhancement spot `USMD_SSW_SERVICE_PROCESSOR`. The workflow step is identified by a Service Name, and the method `IF_USMD_SSW_SYST_METHOD_CALLER~CALL_SYSTEM_METHOD` receives the current Change Request number (`IV_CR_NUMBER`) so you can read workflow data and update application tables or create follow-up processing.

Process flow

  1. Create a custom class and implement `IF_USMD_SSW_SYST_METHOD_CALLER`.
  2. Use `CALL_SYSTEM_METHOD` as the main entry point.
  3. Check `IV_SERVICE_NAME` and dispatch to the correct logic branch.
  4. Read CR context with `CL_USMD_MODEL_EXT=>GET_INSTANCE` and `READ_CHAR_VALUE` when required.
  5. Perform the business update, such as inserting `BUT100` records or calling a helper class.
  6. Return messages in `ET_MESSAGE` and stop processing on model-read errors.
  7. Create the Service Name in Rule-Based Workflow and set the BAdI filter to the same value.
  8. Maintain the BRF+ non-user agent decision table to route to the service with Process Pattern `02`.

Referenced tables

ObjectPurpose
USMD_CREQUESTChange Request header/context source used when reading the current CR.
USMD_T_MESSAGEMessage table returned by the model API and BAdI method.
USMD_TS_SELSelection table used to read CR data from the MDG model API.
USMD_T_CREQUEST_ENTITYEntity list returned by `READ_CHAR_VALUE` for the current Change Request.
BUT100Business partner role assignments inserted by the customer example.
BP_RELMDG entity used in the sample when reading partner-related data.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example

Exact relevant implementation excerpt from the knowledge document.

1class ZCL_MDG_CUST_SYSTEM_CALL definition 2 public 3 final 4 create public . 5 6public section. 7 8 interfaces IF_BADI_INTERFACE . 9 interfaces IF_USMD_SSW_SYST_METHOD_CALLER . 10protected section. 11private section. 12ENDCLASS. 13 14 15 16CLASS ZCL_MDG_CUST_SYSTEM_CALL IMPLEMENTATION. 17 18 19 method if_usmd_ssw_syst_method_caller~call_system_method. 20*---------------------------------------------------------------------------------------------------- 21* Developer - Rafael 22* Date - 23* Charm/TR - 24* Dewscription - Partner Function is saved during the customer change scenario 25* 26*---------------------------------------------------------------------------------------------------- 27*---------------------------------------------------------------------------------------------------- 28* Developer - Jithin Reddy TE476016 29* Date - 11.11.2024 30* Charm/TR - 31* Dewscription - Contact Person role is saved in BUT100 during customer creattion or change with a contact person 32* 33*---------------------------------------------------------------------------------------------------- 34 35 36*** Start of TE476016 - Contact Person role is saved in BUT100 during customer creattion or change with a contact person 37 data: 38 lt_message type usmd_t_message, 39 lo_crequest_api type ref to if_usmd_crequest_api, 40 lt_attribute type usmd_ts_fieldname, 41 ls_attribute type usmd_fieldname, 42 lo_model type ref to if_usmd_model_ext, 43 lt_objlist type usmd_t_crequest_entity, 44 ls_but100 type but100, 45 lt_but100 type table of but100. 46*** End of TE476016 - Contact Person role is saved in BUT100 during customer creattion or change with a contact person 47 48 49 case iv_service_name. 50 when 'ZMDG_CUST_PF_CALL'. 51* Clear exporting parameter 52 clear ev_action. 53 clear et_message. 54 zcl_mdg_cust_util=>system_call_pf_update( exporting iv_cr_number = iv_cr_number 55 iv_service_name = iv_service_name 56 importing et_message = et_message ). 57 58*** Start of TE476016 - Contact Person role is saved in BUT100 during customer creattion or change with a contact person 59 when 'ZMDG_CONTACT_ROLE_DEFAULT'. 60**Get instance of CR API 61 call method cl_usmd_model_ext=>get_instance 62 exporting 63 i_usmd_model = 'BP' 64 importing 65 eo_instance = lo_model 66 et_message = lt_message. 67 if lt_message[] is not initial. 68 et_message[] = lt_message[]. 69 return. 70 endif. 71 72 check lo_model is bound. 73*Get the key field of CR 74 data(lt_sel) = value usmd_ts_sel( ( sign = 'I' 75 option = 'EQ' 76 fieldname = 'USMD_CREQUEST' "usmd0_cs_fld-crequest 77 low = iv_cr_number ) ). 78 79 call method lo_model->read_char_value 80 exporting 81 i_fieldname = 'USMD_CREQUEST' "usmd0_cs_fld-crequest' 82 it_sel = lt_sel 83 if_use_edtn_slice = abap_false 84 importing 85 et_data = lt_objlist. 86 87 data: lv_timestamp type tzntstmps. 88 get time stamp field lv_timestamp. 89 90 91 loop at lt_objlist into data(ls_objlist) where usmd_entity eq 'BP_REL' and usmd_entity_obj eq 'PARTNER2'. 92 select single partner from but100 into corresponding fields of @ls_but100 where partner eq @ls_objlist-usmd_value. 93 if sy-subrc ne 0. 94 " Map fields from <fs_lt_bp_header> to ls_but100 95 ls_but100-partner = ls_objlist-usmd_value. 96 ls_but100-rltyp = 'BUP001'. 97 ls_but100-valid_from = lv_timestamp. 98 ls_but100-valid_to = '99991231235959'. 99 " Add the structure to the internal table lt_but100 100 append ls_but100 to lt_but100. 101 endif. 102 endloop. 103* " Insert data into the database table BUT100 104 insert but100 from table lt_but100. 105*** End of TE476016 - Contact Person role is saved in BUT100 during customer creattion or change with a contact person 106 when others. 107*Dummy 108 endcase. 109 endmethod. 110ENDCLASS.

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

Related questions and keywords

Alternative questions

  • How do I call custom ABAP logic from an MDG workflow system method step?
  • How do I save partner function or contact person data during MDG customer workflow using a system-method BAdI?
  • How do I create a follow-up Change Request or execute custom updates from a Rule-Based Workflow background step?

Possible questions

  • How do I implement `IF_USMD_SSW_SYST_METHOD_CALLER~CALL_SYSTEM_METHOD`?
  • Which BAdI is used for synchronous system methods in MDG workflow?
  • How do I wire a Service Name to a custom workflow step?
  • How do I update business partner roles like `BUT100` from an MDG CR?
  • How do I route a non-user workflow step to custom ABAP logic?

Keywords

SAP MDGRule-Based WorkflowUSMD_SSW_SYSTEM_METHOD_CALLERUSMD_SSW_SERVICE_PROCESSORIF_USMD_SSW_SYST_METHOD_CALLER~CALL_SYSTEM_METHODProcess Pattern 02Synchronous System MethodService NameSE18MDGIMGBRF+WS60800086BUT100USMD_CREQUESTIF_USMD_MODEL_EXTCL_USMD_MODEL_EXT