Entering content frameProcedure documentation CHEERR - Check system message Locate the document in its SAP Library structure

You can check whether a transaction sends an expected system message in the test case with the CHEERR <error number> function.

Enter the CHEERR function directly before the TCD function which should send the system message. If CHEERR is used before the function REF it applies to the first TCD in the referred test module.

Example

You expect the error message 286 in the transaction FB01:

Period is not open for account type & and G/L &.

Funct.

Object

CHEERR

286

TCD

FB01

The transaction is cancelled when an error occurs (processing mode n). If the error which occurred is the expected system message, the transaction result in the log is positive, despite the error.

If the expected system message does not occur, an error message is entered in the log. If the termination flag is set, the procedure is cancelled if the expected error does not occur.

Allow all error messages

The following statement allows all error numbers. You can check whether the result is as you expected by checking the SY fields and. &M variables after the transaction has run:

Funct.

Object

CHEERR

*

Special test case system message variables

If a transaction sends more than one system message, the message variables &M01 to &M04 contain the variable parts of the last message issued. You can get the data from previous messages as follows:

Position on a message:

Insert the following line after the transaction call.

Funct.

Object

IF

&MSG = 'XYYnnn'

where:

X

Message type (one character: A, E, I, S or W)

YY

Message ID (two-character)

nnn

Message number (three-digit number)

The selection criterion can be entered incomplete. They are identified by the length and numbers.

Example

&MSG = ‘X’

Message type

&MSG = ‘YY’

Message ID

&MSG = ‘nnn’

Message number

&MSG = ‘XYY’

Message type and ID

&MSG = ‘Xnnn’

Message type and number

&MSG = 'XYYnnn'

Message type, ID and number

 

Position on the first message sent:

Funct.

Object

IF

&MSG = '*'

Position on the last message sent:

Funct.

Object

IF

&MSG = '='

Scroll in the list of messages sent

When you have positioned on a message with one of the above conditions, you can scroll in the list of all messages using other conditions.

The following table contains the statements which you can use in IF conditions to scroll in the list:

Operator

Go to

&MSG = ‘+’

next message

&MSG = ‘-’

previous message

&MSG = ‘>‘

next message according to last, incl. incomplete, selection &MSG = 'XYYnnn'

 

Further information about a message

When a messages has been found by one of the above conditions, the following variables contain further information:

Message variable

Meaning

&MS1

1. variable part (50-character)

&MS2

2. variable part (50-character)

&MS3

3. variable part (50-character)

&MS4

4. variable part (50-character)

&MST

Message type (one character:

&MSI

Message ID (two-character)

&MSN

Message number (three-digit number)

&MSP

Module pool (eight-character)

&MSD

Screen number (four-character)

&MSX

Message table index (four-character)

&MSL

Total number of messages (four-character)

 

Example

The following example assumes that the following messages were sent by the TCD statement:

STT123

IAA222

EBB333

IAA344

You can go to the first message, e.g. with the following statement:

Funct.

Object

IF

&MSG = '*'

CATT statements

 

ENDIF

 

The message TT123 is put in the message variables.

 

To go to the first message in the message class AA:

Funct.

Object

IF

&MSG = 'AA'

CATT statements

 

ENDIF

 

The message AA222 is put in the message variables.

 

To go to the second message in the message class AA:

Funct.

Object

IF

&MSG = 'AA'

ENDIF

 

IF

&MSG = ‘>‘

CATT statements

 

ENDIF

 

The message AA344 is put in the message variables.

All Messages from the Transaction

The test plan log now contains all messages from the transaction.

Note

The previous module called by REF B2000106 is inactive. It need not be removed from the procedures.

Message Screen SAPMSCEM 0001

In CATT Easy Mode (SCEM) a message screen with the result of the transaction is created at the end of a transaction. This message screen SAPMSCEM 0001 is now appended as the last screen of Enhanced CATT (SCAT) as well. It contains the last message in the transaction. You can make checks against this message.

See TCD – Test transactions.

 

 

 

Leaving content frame