Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migration of unmigrated content due to installation of a new plugin

...

The majority of SMTP (internet) email sent from the MIT R/3 systems is sent via the custom function module Z_SENDMAIL2. This function has been modified from its original state to enable programmers to instruct Z_SENDMAIL2 to intercept and/or log outgoing email that it processes.

Two custom tables, ZEHCAT and ZEMCTRL are used to control both interception and logging of email, and the log is written to a third custom table, ZEMLOG.

Interception of email is useful for debugging, testing, validating, and for providing training. The original motivation for adding this feature to Z_SENDMAIL2 was to provide a method of preventing email from being sent from non-production systems. When a new R/3 system is set up or refreshed, two entries should be established in custom table ZEHCAT to initially discard all email sent via Z_SENDMAIL2. Later, changes can be made as needed to support specific tests.

...

WorksEach call to Z_SENDMAIL2 is associated with an email handling category taken either from parameter P_HNCAT or, if this parameter is not included in the function call, from table ZEMCTRL (see below for details on this distinction). The handling category is referenced in control table ZEHCAT, which contains the following instructions for processing the Z_SENDMAIL2 call based on the assigned handling category:

...

The table of current email handling category assignments can be found here.


When a chain of programs is called, care should be taken in determining the value for field PROG, the calling program name as it appears in SY-CPROG. It is the first program within a chain of calls that is the calling program.

...

The handling category (either passed as parameter P_HNCAT or retrieved from table ZEMCTRL) is referenced in table ZEHCAT, and the following instructions for processing the Z_SENDMAIL2 call are retrieved:

...

The table of current email handling category assignments can be found here.

If there are no existing handling category assignments for a program or if the existing assignments are not suitable, a request may be sent to the SAIS SAP Technical Service for the assignment of a new handling category.

...

Handling category <space><space> is imposed upon all email sent via Z_SENDMAIL2 for which no handling category is specified for the calling program (neither explicitly as parameter P_HNCAT nor mapped via an entry in table ZEMCTRL).

2. ++

Handling category ++ is imposed upon all email sent via Z_SENDMAIL2 for which a handling category is specified (either explicitly as parameter P_HNCAT or mapped via an entry in table ZEMCTRL), but no corresponding entry is found in table ZEHCAT.

...

View the ZBRSMAIL selection screen for the ZEMCTRL or the ZEHCAT tables.

A separate utility program is currently under development that will enable programmers to selectively display or delete entries in the ZEMLOG table. Until that utility is available, transaction SE16 may be used to view email log entries in table ZEMLOG.

...

For a program that passes an explicit P_HNCAT parameter in its call to Z_SENDMAIL2, custom table ZEHCAT is referenced to determine how the call should be processed. This determination is made by reading the control field settings that correspond to the email handling category specified in the P_HNCAT parameter.

...

Email logging uses the same email handling categories as interception and, while logging is controlled by table ZEHCAT, the email data to be logged is written to custom table ZEMLOG.

...

ZEMLOG

Field Name

Data Element

Data Type

Length

Description

 

MANDT

MANDT

CLNT

3

Client

 

HOST

SYHOST

CHAR

8

Host
(system name, e.g. MAPLE, PINE, etc)

 

UNAME

UNAME

CHAR

12

User name

 

CPROG

SYCPROG

CHAR

40

Calling program name (SY-CPROG)

 

TMSTPT

ZNTSTMPL

DEC

21

UTC time stamp in long decimal form
(a number like YYYYMMDDhhmmss.mmmuuun)

 

EXCEP

RS38L_EXCN

CHAR

30

Name of function module exception

 

ERTXT

ZERTXT

CHAR

240

Error text (or a statement of success)

 

RECIP

ZEMAILTO

CHAR

80

Email "To:" address
(first 80 char)

 

SBJCT

ZSUBJECT

CHAR

80

Subject line of Email
(first 80 char)

 

ACTION

ZACTION

CHAR

1

Email processing action
(from ZEHCAT)



 | E-MAIL HANDLING CATEGORIES | DEVELOPMENT RESOURCES |

6. How To Send HTML Messages Using ZSENDMAIL2

...