Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Email handling categories are assigned based on the type of email and the class of recipient to receive the email. The table of current handling category assignments can be found here. Requests for the assignment of an additional handling category should be directed to SAIS SAP Technical Service.There are currently two ways to specify the handling category associated with a call to Z_SENDMAIL:

1. Explicitly pass an email handling category as parameter P_HNCAT.

Every new call to Z_SENDMAIL should pass an explicit email handling category as parameter P_HNCAT. Because many programs that call Z_SENDMAIL pre-date the intercepting and logging modifications, the P_HNCAT parameter is currently optional so that such programs do not require modification simply to add a handling category to the function call. It is intended, however, that every existing call to Z_SENDMAIL will eventually be modified to pass an explicit email handling category.


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


The most direct way to associate a handling category with an existing call to Z_SENDMAIL is to modify the calling program to explicitly pass an email handling category as parameter P_HNCAT, and then transport the modified program to the R/3 test and other environments. call  

call function 'Z_SENDMAIL'

 

exporting

 

p_to

=  <TO ADDRESS>

p_cc

=  <CC ADDRESS>

p_bcc

=  <BCC ADDRESS>

p_from

=  <FROM ADDRESS>

p_reply_to

=  <REPLY-TO ADDRESS>

p_

...

subject

=  <SUBJECT LINE>

p_hncat

= <HANDLING CATEGORY> 

tables

 

message

=  <MESSAGE TABLE>

exceptions

 

error_in_send

=  1

spaces_in_req_params

=  2

invalid_email_address_syntax

=  3

unable_to_open_unix_file

=  4

unable_to_write_to_unix_file

=  5

unable_to_execute_unix_program

=  6

interception_control_tables

=  7

interception_to_spool

=  8

interception_process

...

=  9.

             

2. Create an entry in table ZEMCTRL with the calling program name and the desired email handling category.

If a program that calls Z_SENDMAIL pre-dates the intercepting and logging modifications, such programs do not require modification simply to add a handling category to the function call. Although it is intended that every existing call to Z_SENDMAIL will eventually be modified to pass an explicit email handling category, programmers have the option of using table ZEMCTRL to map such programs to the appropriate handling category.


To map a calling program to a handling category, an entry is made in table ZEMCTRL with the calling program name as it appears in SY-CPROG and the desired email handling category. This method allows only a single handling category per program, and so is not suitable for programs that require more than one handling category. Also, this method does not require a transport to R/3 environments other than the environment in use.

...

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.

...

  1. To whom will the E-Mail be addressed? (This is usually answered with the person's role, not their name. Some example answers are "Card holders", "SAP users entering work orders", "Training & Events administrators", "Requisition approver", "HR Service Center", "Employee timesheet user", "Payroll distribution support", and "User who created the journal voucher")
  2. The subject of the E-Mail? (Some example answers are "Staff out of balance report", "Problem with Lincoln HR feed to campus", "Purchase order is approved", "Duplicate MIT-IDs", "Leave balance status", and "Mass. Health Insurance report".)
  3. What is the name of the ABAP source object containing the call to Z_SENDMAIL?
  4. What is the value of SY-CPROG when Z_SENDMAIL gets control?

    Special Handling Categories

Two particular email handling categories are assigned to address the special circumstance where there is no correlation between a handling category and an entry in table ZEHCAT. This may occur either because no handling category is specified, or because no entry exists in table ZEHCAT for a specified handling category.

1. <space><space>

Handling category <space><space> is imposed upon all email sent via Z_SENDMAIL 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_SENDMAIL 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.

How the imposed handling category is then processed depends on the contents of table ZEHCAT. If there are no entries in table ZEHCAT for the current R/3 system, all email sent via Z_SENDMAIL will be delivered normally, that is, will neither be intercepted nor logged. Table ZEHCAT in the production system, for instance, should typically contain no entries to allow for normal email delivery. If table ZEHCAT contains only the entries shown below for the <space><space> and ++ handling categories, all email sent via Z_SENDMAIL will be intercepted and discarded. Upon creating or refreshing a non-production R/3 system, these entries should be established in table ZEHCAT so that all email is discarded. Changes can later be made to support specific testing.

ZEHCAT
entriesMANDTHNCATCMODEACTION<ALL OTHER FIELDS><client><space><space>XX<space><client>++XX<space>
entries

MANDT

HNCAT

CMODE

ACTION

<ALL OTHER FIELDS>

<client>

<space><space>

X

X

<space>

<client>

++

X

X

<space>

5.  The Tables

Programmers may view or modify the contents of the ZEMCTRL and ZEHCAT tables via utility program ZBRSMAIL. This program presents the following modification options for each table:

...

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.

Table ZEMCTRL

For a program that does not pass an explicit P_HNCAT parameter in its call to Z_SENDMAIL, custom table ZEMCTRL is used to map the calling program to its assigned email handling category. (If the P_HNCAT parameter is passed, ZEMCTRL is not referenced.) Eventually, all calls to Z_SENDMAIL will pass the P_HNCAT parameter and, at that time, table ZEMCTRL will no longer be needed.

...

Table ZEMCTRL contains the following fields:

ZEMCTRLField NameData ElementData TypeLengthDescriptionMANDTMANDTCLNT3ClientPROGPROGRAMMCHAR40Calling program name
(SY-CPROG)HNCATZHNCATCHAR2Associated email handling category

Table ZEHCAT

For a program that passes an explicit P_HNCAT parameter in its call to Z_SENDMAIL, 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.

...

Table ZEHCAT contains the following fields:

ZEHCATField NameData ElementData TypeLengthDescriptionMANDTMANDTCLNT3ClientHNCATZHNCATCHAR2Email handling categoryCMODEZCMODECHAR1Email processing mode
(<space> = Send normally, X = Intercept)ACTIONZACTIONCHAR1Email interception action
(X = Discard, R = Redirect, F = UNIX file, S = Print Spool file)MAILTOZMAILTOCHAR241"To:" Email address for redirect, or
UNIX file path & name suffixed to "/usr/bridges/<system>/saptmp/"CCTOZMAILCCCHAR241"Cc:" Email address for redirectPDESTSYPDESTCHAR4Printer name for print spool filePRIMMSYPRIMMCHAR1Print immediately flag for spool filePRRELSYPRRELCHAR1Delete after printing flag for spool filePRNEWSYPRNEWCHAR1New spool request flag for spool fileLOGZLOGCHAR1Log flag
(<space> = Don't log, X = Log)DESCRIPTIONZEHCATCOMMENTCHAR50Comment field describing HNCAT use and purpose

Table ZEMLOG

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.

...

Table ZEMLOG contains the following fields:

ZEMLOGField NameData ElementData TypeLengthDescriptionMANDTMANDTCLNT3ClientHOSTSYHOSTCHAR8Host
(system name, e.g. MAPLE, PINE, etc)UNAMEUNAMECHAR12User nameCPROGSYCPROGCHAR40Calling program name (SY-CPROG)TMSTPTZNTSTMPLDEC21UTC time stamp in long decimal form
(a number like YYYYMMDDhhmmss.mmmuuun)EXCEPRS38L_EXCNCHAR30Name of function module exceptionERTXTZERTXTCHAR240Error text
(or a statement of success)RECIPZEMAILTOCHAR80Email "To:" address
(first 80 char)SBJCTZSUBJECTCHAR80Subject line of Email
(first 80 char)ACTIONZACTIONCHAR1Email processing action
(from ZEHCAT)| | E-MAIL HANDLING CATEGORIES | DEVELOPMENT RESOURCES |

...