
Use
MESSAGE ( <command interface> )
The MESSAGE command starts a MESSAGE…ENDMESSAGE block. All messages created within the block by SAPGUI, TCD, LOGMSG, FUN, ESF, 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. |
|
SELECTION[] |
This table allows the declaration of more selection options (see below). |
|
RETURNING[] |
This table allows the assignment of parameters that will be filled by the actual values of the message satisfying the rule. |
A rule identifies a message by means of fields MSGTYP, MSGID, and MGSNR and SELECTION. You can specify values for any or none of these fields. For example, if MSGTYP is 'A', and MSGID, MGSNR, and SELECTION 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.
Here, the fields MSGTYP, MSGID, and MGSNR use the comparator ' ='. If you want to use other comparison operators, you can do it under SELECTION.
SELECTION
The table field SELECTION allows you to declare selection options using the following table structure:
|
ATTRIBUTE |
ACTION |
VALUE |
Possible ATTRIBUTES are:
|
MSGTYP |
Message type (severity for ESF(LCP)). |
|
MSGTEXT |
Message text. |
|
MSGID |
Message ID. |
|
MGSNR |
Message number. |
|
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. |
|
MSGKIND |
This only applies to ESF (LPC) commands. |
|
EXCEPTION_ID |
This only applies to ESF (LPC) commands. |
|
EXCEPTION_CLASS |
This only applies to ESF (LPC) commands. |
|
ESF_SYMPTOM |
This only applies to ESF (LPC) commands. |
|
ESF_LIFETIME |
This only applies to ESF (LPC) commands. |
|
ESF_ORIGIN-BO_NAME |
This only applies to ESF (LPC) commands. |
|
ESF_ORIGIN-BO_NODE_NAME |
This only applies to ESF (LPC) commands. |
|
ESF_ORIGIN-BO_NODE_ID |
This only applies to ESF (LPC) commands. |
The ACTION field can contain any of the following compare actions:
|
= |
Equal to |
|
<> |
Not equal to |
|
> |
Greater than (only for numerical values). |
|
< |
Less than (only for numerical values). |
|
>= |
Greater than or equal to (only for numerical values). |
|
<= |
Greater than or equal to (only for numerical values). |
|
CA |
Contains some of. |
|
CS |
Contains string. |
|
NS |
Does not contain string. |
|
NA |
Contains none of. |
|
CO |
Contains only. |
|
CP |
Contains pattern. |
|
NP |
Does not contain pattern. |
|
CN |
Contains not only. |
The VALUE field can be parameterized.
RETURNING
The table field RETURNING allows you to assign parameters to message attributes using the following table structure:
|
ATTRIBUTE |
PARAMETER |
Each time the rule is satisfied by a message, the parameter values are overwritten by the 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 determines how any messages are to be processed. This includes the flagging of the respective eCATT command as having or not having errors, and the copying and processing of application log messages (BAL).
|
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. |
|
B |
Ignore application log messages. In this mode, application log messages (BAL) are not accepted, or analyzed and processed according to the usual rules, until the ENDMESSAGE command. If no message type is given for the rule with this mode in column MSGTYP, all application log messages are ignored. If a particular message type (A, E, I, S, W, X) is specified, application log messages with exactly this type are ignored. If you want several message types (but not all) to be ignored, specify several rules with this mode and the message type to be ignored in each case. |
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.
Changes to the Command Interface
Existing scripts from previous releases will still function unmodified (this is why the fields MSGTYP, MSGID, and MGSNR have been retained instead of only using SELECTION). If you refresh a command interface in such a script, you can then use the new features described above.