SAP MDG · UTILITIES

How do I implement MDG email notifications with change-request links, log messages, and change-document HTML?

Use a trigger-driven MDG mail flow: resolve recipients from configuration or master data, build a change-request link, optionally enrich the body with application log messages or rendered change documents, replace template placeholders, and send through the standard outbound mail API with delivery logging.

Use a trigger-driven MDG mail flow: resolve recipients from configuration or master data, build a change-request link, optionally enrich the body with application log messages or rendered change documents, replace template placeholders, and send through the standard outbound mail API with delivery logging.

Use the MDG email framework as a reusable flow: start from the triggering business event, resolve recipients from configuration or master data, prepare subject and body from template text, and add optional enrichments such as a navigable change-request link, application log messages, or an HTML change-document summary. Then send the message through the standard outbound mail API and store delivery status for resend control.

Process flow

  1. Identify the triggering MDG event or workflow step.
  2. Resolve recipients from configuration or an attribute-based source.
  3. Build the subject and body from template text.
  4. Create a navigable change-request link when the email needs direct MDG access.
  5. Fetch application log messages when the email must show the processing outcome.
  6. Render change-document HTML when the email must summarize field-level changes.
  7. Send the email through the standard outbound mail API.
  8. Persist delivery status for resend control and traceability.

Referenced tables

ObjectPurpose
USMD1210Used in the related MDG utility example to persist a change-request note for traceability.

ILLUSTRATIVE ABAP SAMPLE

Source ABAP example: fetch_slg1_logs.abap

Exact relevant implementation excerpt from the knowledge document set.

1METHOD fetch_slg1_logs. 2 3**Data Declarations 4 DATA:ld_extnum TYPE balnrext, 5 ld_pattern TYPE string, 6 ld_cr_activation_pattern TYPE string, 7 lt_messages TYPE STANDARD TABLE OF balm, 8 ls_msg_output TYPE bapiret2, 9 ld_recent_date TYPE cva_date, 10 ld_date TYPE cva_date, 11 ld_recent_time TYPE cva_time, 12 ld_time TYPE cva_time, 13 ld_date_diff TYPE i, 14 ld_time_diff TYPE cva_time, 15 ld_sec TYPE i. 16 17**Fetch Pattern 18 CONCATENATE 'CRequest Activation-' iv_crequest_id INTO ld_cr_activation_pattern. 19 20**Fetch External Number 21 ld_extnum = ld_cr_activation_pattern. 22 23**Fetch SLG1 Logs 24 CALL FUNCTION 'APPL_LOG_READ_DB' 25 EXPORTING 26 external_number = ld_extnum 27 TABLES 28 messages = lt_messages. 29 30**Sort messages based on Time Stamp Descending 31 SORT lt_messages BY time_stmp DESCENDING. 32 33**Delete messages that do not belong to the input message type 34 DELETE lt_messages WHERE msgty NE iv_message_type. 35 36**Fetch Latest Message Entry, Date and Time 37 READ TABLE lt_messages ASSIGNING FIELD-SYMBOL(<ls_latest_record>) INDEX 1. 38 IF <ls_latest_record> IS ASSIGNED. 39 CONVERT TIME STAMP <ls_latest_record>-time_stmp TIME ZONE sy-zonlo 40 INTO DATE ld_recent_date TIME ld_recent_time. 41 ENDIF. 42 43**Latest messages are being formatted 44 LOOP AT lt_messages ASSIGNING FIELD-SYMBOL(<ls_messages>). 45 46**Fetch Date and Time of the Message Entry 47 CONVERT TIME STAMP <ls_messages>-time_stmp TIME ZONE sy-zonlo 48 INTO DATE ld_date TIME ld_time. 49 50**Fetch Date and Time difference 51 CALL FUNCTION 'SCOV_TIME_DIFF' 52 EXPORTING 53 im_date1 = ld_date 54 im_date2 = ld_recent_date 55 im_time1 = ld_time 56 im_time2 = ld_recent_time 57 IMPORTING 58 ex_days = ld_date_diff 59 ex_time = ld_time_diff 60 EXCEPTIONS 61 start_larger_than_end = 1 62 OTHERS = 2. 63 IF sy-subrc <> 0. 64* Implement suitable error handling here 65 ENDIF. 66 67**Fetch Time Difference in seconds 68 ld_sec = ( ( ld_time_diff+0(2) * 3600 ) + ( ld_time_diff+2(2) * 60 ) + ld_time_diff+4(2) ). 69 70**When Time Difference is less than or equal to 2 minutes 71 IF ld_date_diff LE 0 AND ld_sec LE 120. 72 73 CALL FUNCTION 'MESSAGE_TEXT_BUILD' 74 EXPORTING 75 msgid = <ls_messages>-msgid 76 msgnr = <ls_messages>-msgno 77 msgv1 = <ls_messages>-msgv1 78 msgv2 = <ls_messages>-msgv2 79 msgv3 = <ls_messages>-msgv3 80 msgv4 = <ls_messages>-msgv4 81 IMPORTING 82 message_text_output = ls_msg_output-message. 83 84**Push messages to output messages structure 85 APPEND ls_msg_output TO et_messages. 86 CLEAR ls_msg_output. 87 88 ENDIF. 89 90 ENDLOOP. 91 92 ENDMETHOD.

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

Related questions and keywords

Alternative questions

  • How do I build an MDG email framework for change requests?
  • How can I send MDG emails with recipients resolved from master data?
  • How do I add change history and application log details to an MDG email?

Possible questions

  • How do I create a direct link to an MDG change request in an email?
  • How do I fetch application log messages for an MDG email notification?
  • How do I render changed fields as HTML in an MDG email?
  • How do I resolve email recipients from MDG master data attributes?
  • How do I send an MDG email with an attachment?
  • How do I document a reusable MDG email template flow?

Keywords

MDG email frameworkchange request linkapplication logchange-document HTMLrecipient resolutiontemplate textworkflow contextattachment handlingresend controltraceability