SAP MDG · UTILITIES
How should I document an MDG email process end to end, including trigger, recipient logic, content, logging, and resend?
Document the MDG email by business trigger, recipient resolution, body/subject preparation, any change-document or log enrichment, send mechanism, and resend/logging behavior. Keep table names out of the description unless they are essential, and describe custom persistence or setup by function.
Document the MDG email by business trigger, recipient resolution, body/subject preparation, any change-document or log enrichment, send mechanism, and resend/logging behavior. Keep table names out of the description unless they are essential, and describe custom persistence or setup by function.
Use this guide to document an MDG email process in a generic way, without exposing table names or implementation-specific helper names unless they are essential to the pattern. The document should explain the business event, message source, recipient derivation, placeholder replacement, send mode, and traceability/resend handling.
Process flow
- Identify the business event that triggers the email.
- Define the change request or workflow scope.
- Document recipient resolution from setup, workflow context, or master data attributes.
- Document subject and body template selection and token replacement.
- Document any change history, log output, or status summary included in the message.
- Specify the send path: standard outbound API, BCS document, immediate send, or background send.
- Document send log, duplicate prevention, resend handling, and persisted delivery metadata.
Referenced tables
| Object | Purpose |
|---|---|
configuration source for template setup | Logical description for where email template setup is maintained. |
mapping source for recipient resolution | Logical description for how recipient addresses are derived. |
persistence for email send log | Logical description for resend control and traceability data. |
template store for subject and body text | Logical description for mail content templates and placeholders. |
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
- What should an MDG email documentation template include?
- How do I write a generic MDG email how-to without exposing implementation details?
- What is the recommended structure for documenting MDG email notifications?
Possible questions
- How should I document an MDG email process end to end, including trigger, recipient logic, content, logging, and resend?
- What should an MDG email documentation template include?
- How do I write a generic MDG email how-to without exposing implementation details?
- What is the recommended structure for documenting MDG email notifications?
- How do I describe recipient resolution, template replacement, and logging for MDG emails?