Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

CREATION OF MESSAGE

Former Member
0 Kudos

HI

THIS IS RAVINDER

PLEASE HELP ME HOW TO CREATE MESSAGES.

THANK YOU

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi,


1 Goto Transaction code se91.

Give Message class name  creat message, 
2 Messages are defined in table T100.
in in programging ................



3. Syntax

Message xnnn

x is the type of message ( See: Types of messages )

nnn is the identifier of the message.

Example: message e001

4. Setting the message class

You set the message class for the whole program in the header of thje program:

report my_report message-id .

Setting the message class for a sigle message:

Message ID type number 

Example: message id ‘ZB’ type ‘W’ number ‘004’ with ‘Test’.

5. Types of messages

IInfoPress ENTER to continue
WWarningCorrection possible
EErrorCorrection required

AAbendTransaction terminated
XExitTransaction terminated with short dump
SSuccessMessage on next screen

6. Paramiterized messages

You can paramiterize messages, so that you can insert your own text programmatically
in messages.

When you define the message use & for the parameters:

This is a &1 message

When you call the message use the syntax

Message e001 with ‘bad’

The resulting message: This is a bad message

7. Writing message into a field

Sometimes you want to store e.g. an error message from a function module in a text field instead of displaying it.

Use this syntax to store the message to the field l_errror_text.

CALL FUNCTION … something

IF sy-subrc 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 into l_errror_text. ENDIF. 
  

*reward points if helpful*

Reagrds.

pankaj vashista

4 REPLIES 4

Former Member
0 Kudos

Goto Transaction code se91.

Give Message class name ( Z name that has to be created) & click create

Inside that you can create the messages

Former Member
0 Kudos

Hi,

YOu can create message class in SE91

In this u can define 1000 messages (all types of messges)

with 3 digit no start with 000 upto 999.

You can call this in ur program.

Syntax: Zmess.class name E(3 digit no.)

I(3 digit no.)

S(3 digit no.)

W(3 digit no.)

E error message, I infomation message, S status message, W warning message,

Regards,

Former Member
0 Kudos

Hi,


1 Goto Transaction code se91.

Give Message class name  creat message, 
2 Messages are defined in table T100.
in in programging ................



3. Syntax

Message xnnn

x is the type of message ( See: Types of messages )

nnn is the identifier of the message.

Example: message e001

4. Setting the message class

You set the message class for the whole program in the header of thje program:

report my_report message-id .

Setting the message class for a sigle message:

Message ID type number 

Example: message id ‘ZB’ type ‘W’ number ‘004’ with ‘Test’.

5. Types of messages

IInfoPress ENTER to continue
WWarningCorrection possible
EErrorCorrection required

AAbendTransaction terminated
XExitTransaction terminated with short dump
SSuccessMessage on next screen

6. Paramiterized messages

You can paramiterize messages, so that you can insert your own text programmatically
in messages.

When you define the message use & for the parameters:

This is a &1 message

When you call the message use the syntax

Message e001 with ‘bad’

The resulting message: This is a bad message

7. Writing message into a field

Sometimes you want to store e.g. an error message from a function module in a text field instead of displaying it.

Use this syntax to store the message to the field l_errror_text.

CALL FUNCTION … something

IF sy-subrc 0. MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4 into l_errror_text. ENDIF. 
  

*reward points if helpful*

Reagrds.

pankaj vashista

Former Member
0 Kudos

Hi,

Messages are single texts, stored in table T100, that you can maintain in Transaction SE91 or by forward navigation in the ABAP Workbench. T100 has the following structure:

Language key

Twenty-character message class

Message number

Message text (up to 72 characters)

Message classes assign messages to an application (maybe to a development class, for example), and the message numbers identify the individual messages within the message class. When you call a message in ABAP, you need to specify the message class and message number. The language key is supplied by the system according to the system language environment.

For information about creating message classes and messages, refer to the Creating Messages section of the ABAP Workbench documentation.

You send messages using the ABAP statement MESSAGE. The statement specifies the message class, number, and type of the message.

The message class and number are used to identify the message in table T100. The message type is one of A, E, I, S, W, or X, and defines how the ABAP runtime should process the message.

Messages can either be displayed in modal dialog boxes, or in the status bar of the screen. How a message is processed depends on its type and on the context in which the

MESSAGE statement occurs.

The MESSAGE statement has three variants and several additions:

Using a Global Message Class

If the introductory statement of a program contains the addition

... MESSAGE-ID <id>.

and a message class <id> contained in table T100, you can use the MESSAGE statement as follows:

MESSAGE <t><num> [WITH <f1> ... <f4>] [RAISING <exc>].

where <t> is the single-character message type and <nnn> the three-digit message number. The system retrieves the corresponding message text from table T100 for the message class specified in the introductory statement, and displays it. The display depends on the message type and the context in which the message is sent.

Specifying the Message Statically

To specify the message class, message number, and message type statically, use the following form of the MESSAGE statement:

MESSAGE <t><nnn>(<id>) [WITH <f1> ... <f4>] [RAISING <exc>].

This statement is like the first variant, but here you specify the message class <id> within the statement. This specification overrides any message class that you may have specified at the beginning of the program.

Specifying the Message Dynamically

To specify the message class, message number, and message type dynamically, use the following form of the MESSAGE statement:

MESSAGE ID <id> TYPE <t> NUMBER <n> [WITH <f1> ... <f4>] [RAISING <exc>].

where <id>, <t>, and <n> are fields containing the message class, message number, and message type respectively. The system uses the field contents to read the appropriate message from table T100 and displays it according to the message context.

Filling Message Texts Dynamically

Message texts in table T100 can contain up to four ampersand characters as placeholders. You can replace these at runtime using the WITH addition in the MESSAGE statement:

MESSAGE ... WITH <f1> ... <f4>.

The contents of fields <f1> ... <f4> are then inserted sequentially into the message text in place of the placeholders.

Messages and Exceptions

Within function modules and methods, you can use the RAISING addition in the MESSAGE statement to trigger exception:

MESSAGE..... RAISING <exc>.

If the calling program does not handle the exception <exc> itself, the message is displayed, and the program continues processing in the manner appropriate to the message type and context. If the calling program handles the exception, the message is not displayed, but the exception is triggered. In this case, the message class, message number, message type, and any values of placeholders are placed in the system fields SY-MSGID, SY-MSGNO, SY-MSGTY, and SYMSGV1

to SY-MSGV4 in the calling program.

Regards,

Bhaskar