Show TOC

COCD_MESSAGE_DEST_TEMPLATE

Functionality

The function module COCD_MESSAGE_DEST_TEMPLATE acts as a copy template in creating function modules that you want to use as message recipients. When defining your own function modules, please remember that they must correspond to the copy template described in the following points in terms of interface, function call and structure.

Function module interface

The function module interface contains the following parameters.

Table parameters Reference field Description
DEST_NAME RCTC51-CSDES name of the message recipient
Table parameters Reference structure Description
SCOMH DB table COMH message headers
SCOME DB table COME message characteristics
SCOMP structure RCOMP log entries
Exceptions
not allowed

Note:

When defining your own function modules, use only the parameters set out above.
The function module target fields to which the message characteristics are transferred are defined in the function module as local rather than import parameters.
Exceptions are not checked. Exceptions must be handled or intercepted in the function module itself.

Calling the function module

The function module is called by process management as soon as at least one message is present for the corresponding message recipient (type 1 R/3 function module ). During function call, message headers are transferred to table SCOMH and message characteristics to table SCOME. Table SCOMP is empty.

If several messages are sent to the message recipients at the same time,the SCOMH table has several entries. In this case, the function module processes all messages transferred to SCOMH during a function call.

Note:

When programming your own function modules, you can assume that SCOMH contains several messages.
In exceptional cases, it is possible to furnish the function module with one message only and to call it up several times accordingly. In this case, a unique roll area is set every time and after every call, a COMMIT WORK is carried out. For function modules with this requirement, you must set the Ind. (individual processing) indicator in the relevant message destination.
Warning: As this procedure leads to a considerable decrease in performance, it should be applied in exceptional cases only.

Function module structure

The following sections explain the coding contained in the copy template.

1. Variable definitions
a) The target fields to which the values from the messages should be transferred are defined in the function module as local variables (see Coding, section *Target fields).
b) The names of the target fields (written exactly the same as the local variables) are written in the internal table TARGET_FIELD_NAMES (see Coding, section *Fill table TARGET_FIELD_NAMES ).
This table is later transferred to the function module COCM_MESS_CHARS_TO_DEST_FIELDS.
Two additional indicators are assigned to each target field:
The indicator CHK_OBLI specifies how the function module reacts if the corresponding characteristic is marked as mandatory but is missing in the message.
The indicator CHK_INIT specifies how the function module will react to a characteristic that has not been assigned a value (that is, a blank characteristic).
The indicators can have the following values:
Value Constant Action
0 OFF No error should be triggered.
1 RAISE_WARNING ERRKZ should be set to 'warning'.
2 RAISE_ERROR ERRKZ should be set to 'error'.
The constants RAISE_ERROR, RAISE_WARNING and OFF are defined in the LCOCDT0P Include.
2. Call the function COCM_MESS_CHARS_TO_DEST_FIELDS
When calling this function, the names of the target fields contained in the TARGET_FIELD_NAMES table are transferred. The function executes the following steps:
a) It determines the message characteristics assigned to the target fields in Customizing.
b) It reads the corresponding characteristic values from the SCOME table and writes them together with the target field names into the internal TARGET_FIELD_VALUES table.
c) If a mandatory characteristic is missing or has not been assigned a value, log entries (SCOMP table) are generated and the SCOMH-ERRKZ indicator set according to the settings made (CHK_OBLI and CHK_INIT indicators).
3. Process ICOCMF01 Include
The target field names and values in TARGET_FIELD_VALUES are copied using field symbols to the locally-defined target fields of the same name. This procedure is summarized in the ICOCMF01 Include.
4. Further processing
The locally-defined target fields can be processed as desired in the function module.