SAP MDG · UTILITIES

How does the MDG email framework build a navigable change-request URL for the body or subject?

The change-request link is built from the MDG workflow navigation context and then converted into a Web Dynpro URL with `cl_wd_utilities=>construct_wd_url`. The method reads navigation parameters from `cl_usmd_wf_navigation_handler`, adds client/language and optional workflow-step values, removes unwanted parameters, and returns the absolute URL.

The change-request link is built from the MDG workflow navigation context and then converted into a Web Dynpro URL with `cl_wd_utilities=>construct_wd_url`. The method reads navigation parameters from `cl_usmd_wf_navigation_handler`, adds client/language and optional workflow-step values, removes unwanted parameters, and returns the absolute URL.

The method first checks that either a change request ID or workflow item ID is available. It then reads the MDG navigation context, maps the returned name-value pairs into Web Dynpro URL parameters, adds SAP client and optional workflow step data, removes parameters such as ACTION, IS_CREQ_MODE, and SAP-LANGUAGE, and finally calls `cl_wd_utilities=>construct_wd_url` to create the absolute link.

Process flow

  1. Check that a change request ID or workflow item ID is available.
  2. Call `cl_usmd_wf_navigation_handler=>get_instance( )` with the change request or work item.
  3. Read the navigation parameters from `get_navigation_parameters( )`.
  4. Copy the returned parameters into `usmd_t_value` / `tihttpnvp` format.
  5. Add `SAP-CLIENT` and, if needed, the workflow step from `SWW_WI_CONTAINER_READ`.
  6. Remove parameters not needed for URL construction, such as `ACTION`, `IS_CREQ_MODE`, and `SAP-LANGUAGE`.
  7. Call `cl_wd_utilities=>construct_wd_url( )` with the application name and parameters.
  8. Return the generated absolute URL or raise `url_not_found`.

Referenced tables

ObjectPurpose
SWCONTWorkflow container table read into `lt_cont` to extract `ACTION_RESULT` and `APPSTEP`.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example

Exact relevant implementation excerpt from the knowledge document.

1METHOD get_cr_link. 2 DATA: 3 4 lo_navigation_handler TYPE REF TO if_usmd_wf_navigation_handler, 5 6 ls_navigation_parameters TYPE usmd_s_wf_obn_params, 7 8 ls_navigation_parameter TYPE usmd_s_namevalue, 9 10 lv_application_id TYPE string, 11 12 lv_action TYPE usmd_action, 13 14 key_value_pairs_for_mapping TYPE usmd_t_namevalue, 15 16 url_parameters TYPE usmd_t_value, 17 18 lo_ui_service TYPE REF TO if_usmd_ui_services, 19 20 id_wi_id TYPE sww_wiid, 21 22 lv_main_component TYPE REF TO if_wd_component, 23 24 lv_value_list TYPE usmd_ts_seqnr_value, 25 26 lv_url TYPE string, 27 28 lv_wdy_key_value_table TYPE wdy_key_value_table, 29 30 lv_apb_lpd_t_params TYPE apb_lpd_t_params, 31 32 lt_para TYPE tihttpnvp, 33 34 lv_para TYPE ihttpnvp. 35 36 DATA: 37 38 fieldname_value_pair TYPE usmd_s_value. 39 40 DATA: 41 42 lv_accessibility TYPE abap_bool, 43 44 lv_langu(2) TYPE c, 45 46 lo_application TYPE REF TO if_wd_application, 47 48 lv_shm_instance TYPE shm_inst_name, 49 50 lv_guid TYPE guid_32, 51 52 ls_rfc TYPE rfcsi. 53 54 CONSTANTS : lc_client TYPE string VALUE 'SAP-CLIENT', 55 56 lc_language TYPE string VALUE 'SAP-LANGUAGE'. 57 58 FIELD-SYMBOLS: 59 60 <key_value_pair> TYPE powl_namevalue_sty. 61 62 CHECK iv_crequest_id IS NOT INITIAL OR 63 id_wi_id IS NOT INITIAL. 64 65 lo_navigation_handler = cl_usmd_wf_navigation_handler=>get_instance( 66 iv_workitem_id = id_wi_id 67 iv_crequest_id = iv_crequest_id ). 68 69 ls_navigation_parameters = lo_navigation_handler->get_navigation_parameters( ). 70 71 lv_application_id = ls_navigation_parameters-ui_appl. 72 73 READ TABLE ls_navigation_parameters-parameters INTO ls_navigation_parameter 74 75 WITH KEY key = cl_usmd_wf_navigation_handler=>gc_par_logical_action. 76 77 IF sy-subrc = 0. 78 79 lv_action = ls_navigation_parameter-value. 80 81 ELSE. 82 83 CLEAR lv_action. 84 85 ENDIF. 86 87 key_value_pairs_for_mapping = ls_navigation_parameters-parameters. 88 89*--------------------------------------------------------------------* 90 91 LOOP AT key_value_pairs_for_mapping ASSIGNING <key_value_pair>. 92 93 fieldname_value_pair-fieldname = <key_value_pair>-key. 94 95 fieldname_value_pair-value = <key_value_pair>-value. 96 97 APPEND fieldname_value_pair TO url_parameters. 98 99 ENDLOOP. 100 101 fieldname_value_pair-fieldname = lc_client. 102 103 fieldname_value_pair-value = sy-mandt. 104 105 INSERT fieldname_value_pair INTO TABLE url_parameters . 106 107 CALL FUNCTION 'CONVERSION_EXIT_ISOLA_OUTPUT' 108 EXPORTING 109 input = sy-langu 110 IMPORTING 111 output = lv_langu. 112 113 114 IF iv_wi_id IS SUPPLIED AND iv_wi_id IS NOT INITIAL. 115 DATA: lt_cont TYPE TABLE OF SWCONT, 116 ls_cont TYPE SWCONT. 117 118 CALL FUNCTION 'SWW_WI_CONTAINER_READ' 119 EXPORTING 120 wi_id = iv_wi_id

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

Related questions and keywords

Alternative questions

  • How is the change request link constructed in MDG email notifications?
  • What logic creates the MDG change-request URL for emails?
  • How do I generate a clickable MDG change request link in ABAP?

Possible questions

  • How do I generate a clickable MDG change request link in ABAP?
  • How is the MDG workflow item context added to the URL?
  • How do I remove unwanted URL parameters from the generated link?
  • How can I use the link in an email template placeholder?
  • What transaction or class is used to construct the MDG URL?

Keywords

MDGchange requestemail notificationURLWeb Dynproworkflow contextABAPcl_wd_utilitiescl_usmd_wf_navigation_handlerSWW_WI_CONTAINER_READ