MESSAGE

Use

MESSAGE ( <command interface> )

The MESSAGE command starts a MESSAGE…ENDMESSAGE block. All messages created within the block by SAPGUI, TCD, LOGMSG, FUN, inline ABAP, WEBDYNPRO, CALLSTATIC and CALLMETHOD commands are collected. At the end of the block, the messages are available in the command interface of the ENDMESSAGE command.

The command interface of the ENDMESSAGE command also contains the target system in which each message occurred. The command causing the message is noted in the log.

MESSAGE ( <message command interface> ).

SAPGUI ( <command interface 1> ).

SAPGUI ( <command interface n> ).

ENDMESSAGE ( <endmessage command interface> ).

MESSAGE Command Interface

In the command interface, you can define rules that specify how the test script should proceed after a message occurs. Each rule has the following fields:

Field

Description

MODE

Message handling mode.

EXIT

If the EXIT field is initial, execution continues with the next eCATT command. If the EXIT field has the value X, execution skips to the ENDMESSAGE command when the current command finishes.

MSGTYP

Message type.

MSGID

Message ID.

MGSNR

Message number.

A rule identifies a message by means of fields MSGTYP, MSGID, and MGSNR. You can specify values for any or none of these fields. For example, if MSGTYP is ‘A’, and MSGID and MGSNR are not specified, all messages of type ‘A’ are dealt with by that rule.  If all the fields are empty, all messages will be dealt with according to that rule.

When defining a rule, you can only enter fixed values in the fields MODE, EXIT, MSGTYP, and MSGID. Only for the field MSGNR can you assign a parameter or a fixed value.

When defining a rule, you cannot use the variable parts of a message for identifying the message.

Field

Description

MSGV1

First variable part of a message.

MSGV2

Second variable part of a message.

MSGV3

Third variable part of a message.

MSGV4

Fourth variable part of a message.

You can assign parameters to the MSGV fields of a rule. Each time the rule is satisfied by a message, the parameter values are overwritten by the MSGV field values from the current message. You can read the collected messages from the ENDMESSAGE command interface after the execution of the ENDMESSAGE command but it is usually sufficient to parameterize the variable parts of the expected message.

The mode of a rule specifies whether the relevant eCATT command is marked as having an error.

Mode

Description

F

Failure. The relevant command is marked as having an error.

A

Allowed. The relevant command is marked as not having an error.

E

Expected. By ENDMESSAGE, at least one expected message must have been collected by at least one rule. If not, ENDMESSAGE is marked as having an error.

R

Required. By ENDMESSAGE, every rule with this mode must have  registered at least one message. If not, ENDMESSAGE is marked as having an error.

Standard rules that require no specification in the command interface are:

MODE

EXIT

MSGTYP

A

S

A

I

A

W

F

C

F

X

A

F

X

E

F

X

X

Rules are evaluated in the order in which they are defined in the command interface. The standard rules are evaluated after those in the command interface.

When a message occurs, the rules are evaluated one after the other. If a message matches the selection criteria of a rule, the message is not checked against any remaining rules. Therefore, the most specific rules should be first, and the most generic last.