0% found this document useful (0 votes)
35 views

Message Class 2

The document discusses how to create and use message classes in ABAP to maintain standardized error messages across multiple programs. It explains that a message class acts as a container that holds messages identified by unique numbers, avoiding the need to hardcode the same text in every program. It provides instructions for creating a message class using transaction SE91 and then calling messages using the MESSAGE statement, specifying either the class and number or defining the class in the REPORT statement. Placeholders can be used in messages to insert variable values at runtime.

Uploaded by

Vikram Bigamudre
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
35 views

Message Class 2

The document discusses how to create and use message classes in ABAP to maintain standardized error messages across multiple programs. It explains that a message class acts as a container that holds messages identified by unique numbers, avoiding the need to hardcode the same text in every program. It provides instructions for creating a message class using transaction SE91 and then calling messages using the MESSAGE statement, specifying either the class and number or defining the class in the REPORT statement. Placeholders can be used in messages to insert variable values at runtime.

Uploaded by

Vikram Bigamudre
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

We know that we can use MESSAGE statement to issue a message in ABAP.

What if we want to issue the same message in more than one program? Do we need to hard code the same message text or maintain the same text symbols in all the programs? The answer is NO. Instead of maintaining the same message text in all the programs maintain the message in a Message class and use it in all the programs. What is a Message Class? Message Class is a like a container which holds a number of different messages. Each message in the message class is identified with unique message number. So when you call a message in a ABAP program, you need to specify the message class and message number. How to create a Message Class? First go to t-code SE91 i.e. Message Maintenance, enter the name of the message class and click on create button.

Maintain the required message texts with message numbers. Then save the entries and assign it to proper development class and transport request. Once the message class is saved we can use it in our ABAP programs.

Messages can be issued as follows.


MESSAGE s000(ztest).

Output

In the above code, the message number, message class and message type are specified in the MESSAGE statement. We can also specify the message class in the REPORT statement as shown below, so that we can skip the message class in the MESSAGE statements of the program.
REPORT zmessages

MESSAGE-ID ztest
. MESSAGE s000.

We can also maintain placeholders for variables in messages.

In the above message & is the placeholder. At runtime the placeholders (&) will be replaced by the variable values specified in the MESSAGE statement.
REPORT zmessages MESSAGE-ID ztest. MESSAGE s001

WITH XYZ 1000


.

Output

The values XYZ and 1000 replaces the placeholders in the actual message.

You might also like