Application Development and Automation 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: 
Read only

Messages

Former Member
0 Likes
5,405

Hi,

Any information on messages or message types would be appreciated.

Regards,

Uday.

8 REPLIES 8
Read only

Former Member
3,059

hI

There are 6 types of normal messages,

They are,

Sno ->Notation->TYPE->DESCRIPTION->DILOG BEHAVIOUR->MESSAGE APPEARS IN

1. i ->Info Message->Program continues after Interruption->Model Dilog Box

2. s->Set Message->Program continues without Interruption->Status bar of next screen

3. w->Warning->Context Dependent->Status bar or model dilog box

4. e->Error->Context Dependent->Status bar or model dilog box

5. a->Abort->Program Cancelled->Model dilog box

6. x->Exit->Runtime error MESSAGE_TYPE_X triggered->Short dump

You use the MESSAGE statement to send dialog messages to the users of your

program. When you do this, you must specify the three digit message number

and the message class.

Message number and message class clearly identify the message to be displayed.

You use the message type to specify where the message is to be displayed. You

can test the display behavior for using the different message types by means of the

DEMO_MESSAGES demo program that is shipped in the SAP standard.

If the specified message contains placeholders, you can supply them with values

from your program by using the WITH addition. Instead of the placeholders, the

transferred values then appear in the displayed message text.

For further information on the syntactical alternatives to the MESSAGE statement,

refer to the keyword documentation.

Let me explain how to define messages in your program.

Prefix of the message specifies the message type eg. E for error message.

Using ‘&’ we can include a max. of 4 variables in message text.

message i001 with var1 var2.

Message-id can be specified at

1. program xxxx message-id yyy.

2. message e001(yyy).

Read only

Former Member
0 Likes
3,059

hI

MESSAGE TYPES IN idoc

Create Message Type

Go to transaction code WE81

Change the details from Display mode to Change mode

After selection, the system will give this message “The table is cross-client (see Help for further info)”. Press Enter

Click New Entries to create new Message Type

Fill details

Save it and go back

Read only

Former Member
0 Likes
3,059

hi

Check to this,

Reward if helpful

Syntax Diagram

MESSAGE

Variants:

1. MESSAGE xnnn.

2. MESSAGE ID id TYPE mtype NUMBER n.

3. MESSAGE xnnn(mid).

4. MESSAGE msg TYPE mtype.

Effect

Sends a message. Messages are stored in the table T100, are processed using transaction SE91 and can be created by forward navigation.

The ABAP runtime environment handles messages according to the type declared in the MESSAGE statement and the context in which the message was sent. The following message types exist:

A - Abend

: Transaction terminated

E - Error

: Error message

I - Info

: Information

S - Status

: Status message

W - Warning

: Correction possible

X - Exit

: Transaction terminated with short dump

Messages are mainly used to handle user input on screens. The following table shows the behavior of each message type in each context. An explanation of the numbers used is included at the end of the table:

A E I S W X

-


PAI Module 1 2 3 4 5 6

PAI Module for POH 1 7 3 4 7

6

PAI Module for POV 1 7 3 4 7

6

-


AT SELECTION-SCREEN ... 1 8 3 4 9 6

AT SELECTION-SCREEN for POH 1 7 3 4 7 6

AT SELECTION-SCREEN for POV 1 7 3 4 7 6

AT SELECTION-SCREEN ON EXIT 1 7 3 4 7 6

-


AT LINE-SELECTION 1 10 3 4 10 6

AT PFn 1 10 3 4 10 6

AT USER-COMMAND 1 10 3 4 10 6

-


INITIALIZATION 1 11 3 4 11 6

START-OF-SELECTION 1 11 3 4 11 6

GET 1 11 3 4 11 6

END-OF-SELECTION 1 11 3 4 11 6

-


TOP-OF-PAGE 1 11 3 4 11 6

END-OF-PAGE 1 11 3 4 11 6

TOP-OF-PAGE DURING ... 1 10 3 4 10 6

-


LOAD-OF-PROGRAM 1 1 4 4 4 6

-


PBO Module 1 1 4 4 4 6

AT SELECTION-SCREEN OUTPUT 1 1 4 4 4 6

-


Procedure: see

Messages

-


The message appears in a dialog box and the program terminates. When the user has confirmed the message, control returns to the next- highest area. All the internal sessions are deleted from the stack.

The message appears in the status line. Then PAI terminates and the system returns to the current screen. All the screen fields combined using FIELD or CHAIN are now ready for input. The user must enter new values. The system triggers the PAI event again, with the new values.

The message appears in a dialog box. Once the user has confirmed the message, the program continues immediately after the MESSAGE statement.

The message appears in the status line of the next screen. The program continues immediately after the message statement.

The message appears in the status line. Then the system continues as in 2, except that the user can quit the message using ENTER without having to enter new values. The system continues handling the PAI event from immediately after the message statement.

No message is displayed and a runtime error, MESSAGE_TYPE_X, is triggered. The short dump text contains the message identification.

The program terminates with a runtime error DYNPRO_MSG_IN_HELP. While F1 and F4 are processed, the system cannot send error messages or warnings.

The message appears in the status line. Then the system stops selection screen processing and returns to the selection screen itself. The screen fields specified in the additions to the AT SELECTION-SCREEN statement are now ready for input. The user must enter new values. The system then starts processing the selection screen again with the new values.

The message appears in the status line. Then the system continues as in 8, except the the user can quit the message using ENTER, without having to enter new values. The system continues handling the PAI event from immediately after the message statement.

The message appears in the status line and the processing block terminates. The list level is displayed as before.

The message appears in the status line and the processing block terminates. The system then returns to the program call.

For a demonstration of messages in different contexts, see Example Programs for Messages.

Variant 1

MESSAGE xnnn.

Extras:

1. ... WITH f1 ... f4

2. ... RAISING exception

3. ... INTO f

4. ... DISPLAY LIKE mtype

Effect

Outputs the message nnn from the message class i with the type x. You must specify the message class i using the MESSAGE-ID addition to the REPORT statement, PROGRAM, or another introductory program statement.

Example

MESSAGE I001.

You can specify a different message class in parentheses after the error number, for example MESSAGE I001(SU).

When executing the statement, the following system variables are set:

  • SY-MSGID (message class)

  • SY-MSGTY (message type)

  • SY-MSGNO (message number)

Addition 1

... WITH f1 ... f4

Effect

Inserts the contents of a field fi in the message instead of in the placeholder &i. If unnumbered variables (&) are used in a message text, these are replaced consecutively by the fields f1 to f4.

To aid compilation, only numbered variables (&1 to &4) are to be used in future if several fields are involved.

If a "&" is supposed to appear in the message at runtime, you must enter &&.

In the long text of a message, the symbol &Vi& is replaced by the field contents of fi.

After WITH, you can specify 1 to 4 fields.

Note

You can output up to 50 characters per field. If the field contains more characters, these are ignored.

Example

MESSAGE E0004 WITH 'Hugo'.

Note

When executing the statement, the contents of the fields f1 to f4 are assigned to the system fields SY-MSGV1, SY-MSGV2, SY-MSGV3 and SY-MSGV4.

Addition 2

... RAISING exception

Effect

Only possible within a function module or a method (see FUNCTION, METHOD):

Triggers the exception exception.

If the program calling the function module or method handles the exception itself, control returns immediately to that program (see CALL FUNCTION and CALL METHOD). Only then are the current values passed from the procedure to the EXPORTING-, CHANGING- (und RETURNING) parameters of the function module or method, if they are specified as pass-by- reference. However, the calling program can refer to the system field values (see above).

If the calling program does not handle the exception itself, the message is output (see RAISE).

You cannot use this addition in conjunction with the ... INTO cf addition.

Note

If, during a Remote Function Call, an error occurs in the target system, details of the error message are passed back to the calling system in the following system fields: SY-MSGNO, SY-MSGID, SY-MSGTY, SY-MSGV1, SY-MSGV2, SY-MSGV3, and SY-MSGV4. These fields are initialized before every RFC. If a short dump or a type X message occurs, the short text of the dump is transferred to the caller, and the contents of SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 assigned by the system.

In RFC-enabled function modules, no ABAP statements are allowed that would end the RFC connection (for example, either LEAVE or SUBMIT without the AND RETURN addition).

Example

MESSAGE E001 RAISING NOT_FOUND.

Addition 3

... INTO f

Effect

Instead of displaying the message, the system places the message text in the field f. The message type is not evaluated.

You cannot use this addition in conjunction with the ...RAISING exception or the DISPLAY LIKE mtype addition. The system sets the following system variables: SY-MSGID (message class), SY-MSGTY (message type), SY-MSGNO (message number) and SY-MSGV1, SY-MSGV2, SY-MSGV3, SY-MSGV4 (parameters).

Example

DATA msgtext(72).

...

MESSAGE E004 WITH 'Hugo' INTO msgtext.

Addition 4

... DISPLAY LIKE mtype

Effect

The message display uses the icon of the message type mtype but the message is handled according to its actual type.

Note

This addition cannot be used in conjunction with the addition ... INTO.

Example

MESSAGE I004 DISPLAY LIKE 'E'.

Variant 2

MESSAGE ID id TYPE mtype NUMBER n.

Extras:

1. ... WITH f1 ... f4

2. ... RAISING exception

3. ... INTO f

4. ... DISPLAY LIKE mtype

Effect

The message components are set dynamically:

ID

Message class

TYPE

Message type

NUMBER

Message number

The addition MESSAGE-ID of the introductory program statement is not required or is overridden.

Addition 1

... WITH f1 ... f4

Addition 2

... RAISING exception

Addition 3

... INTO f

Addition 4

... DISPLAY LIKE mtype

Effect

As in variant 1.

Example

MESSAGE ID 'SU' TYPE 'E' NUMBER '004' WITH 'Hugo'.

Outputs the message with the number 004 and MESSAGE-ID SU (see above) as an E (Error) message and replaces the first variable (&) with 'Hugo'.

Example

MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

Constructs the message dynamically from the contents of the system fields SY-MSGID, SY-MSGTY, SY-MSGNR , SY-MSGV1 ,SY-MSGV2,SY-MSGV3,and SY-MSGV4. These may, for example, be set by an exception after CALL FUNCTION or CALL TRANSACTION ... USING.

Variant 3

MESSAGE xnnn(mid).

Extras:

1. ... WITH f1 ... f4

2. ... RAISING exception

3. ... INTO f

4. ... DISPLAY LIKE mtype

Effect

As in variant 1. The message class is determined by specifying mid. The addition MESSAGE-ID of the introductory program statement is not required or is overridden.

Addition 1

... WITH f1 ... f4

Addition 2

... RAISING exception

Addition 3

... INTO f

Addition 4

... DISPLAY LIKE mtype

Effect

As in variant 1.

Example

MESSAGE X004(SU) WITH 'Hugo'.

Variant 4

MESSAGE msg TYPE mtype.

Extras:

1. ... RAISING exception

2. ... DISPLAY LIKE mtype

Effect

With this variant, the message can be passed directly in the form of a character-like field. The message type is specified using the required TYPE addition.

Addition 1

... RAISING exception

Addition 2

... DISPLAY LIKE mtype

Effect

As in variant 1.

Example

MESSAGE 'File not found.' TYPE 'E'.

The text 'File not found.' is output as the error message.

Exceptions

Non-Catchable Exceptions

Cause: Message type unknown

Runtime Error: MESSAGE_TYPE_UNKNOWN

Cause: Triggers termination with a short dump

Runtime Error: MESSAGE_TYPE_X

Additional help

Messages

Read only

Former Member
0 Likes
3,059

Hi Uday,

There are 6 message types

1.Information message("I"),

2.Status message("S"),

3.Error message("E"),

4.Warning("W"),

5.Termination message("A"), ie Abort

and

6.Exit message("X").

and Syntax will be

*MESSAGE { msg | txt } [message_options]. *

Hope its Useful,

Kota

Read only

Former Member
0 Likes
3,059

Hi,

Message Classes are container of user-defined messages. We can create our own messages to be displayed in the screen and we can create these messages in a message pool inside the message class.

SE91 is the Tcode to create a message class.

The created messages can be called from programs using the statement 'MESSAGE'.

SYNTAX:

MESSAGE <type_of_message><message id>(message_class).

TYPES OF MESSAGES:

-


S - Status message.

I - Information message.

E - Error message.

W - Warning message.

A - Abort message.

T - Terminate message.

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.

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

I(3 digit no.)

S(3 digit no.)

W(3 digit no.)

Regards,

kavitha.

Read only

Former Member
0 Likes
3,059

Hi

Information on messages:

This can be done in transaction SE91 - Message Maintenance.

Messages allow you to communicate with the users from your programs.

They are mainly used when the user has made an invalid entry on a screen.

To send messages from a program, you must link it to a message class.

Each message class has an ID, and usually contains a whole set of message. Each message has a single line of text, and may contain placeholders for variables (e.g. & & & - three variables).

All messages are stored in table T100.

Once you have created a message, you can use it in the MESSAGE statement in a program.

Types of messages:

i - information message,

w - warning message,

a- abort message,

e - error message,

s - status message,

x - exit message.

Thanks&Regards,

Chaithanya.

Read only

Former Member
0 Likes
3,059

Hai Uday,

Messages Without Screens

This context applies to all situations that do not belong to any screen processing. In ABAP programs, this includes the following processing blocks:

PBO modules (PBO of screens)

The selection screen event AT SELECTION-SCREEN OUTPUT (PBO of a selection screen)

The reporting events INITIALIZATION, START-OF-SELECTION, GET, and END-OF-SELECTION

The list events TOP-OF-PAGE and END-OF-PAGE

All other processing blocks are associated with screen processing (reacting to user input).

Message Processing

Type

Display

Processing

A

Dialog box

Program terminates, and control returns to last area menu

E

In PBO context, the same as type A, otherwise status bar

In PBO context like type A,

otherwise, program terminates and control returns to point from which the program was called

I

In PBO context, the same as type S, otherwise dialog box

Program continues processing after the MESSAGE statement

S

Status bar of next screen

Program continues processing after the MESSAGE statement

W

In PBO context, the same as type S, otherwise status bar

In PBO context like type S,

otherwise, program terminates and control returns to point from which the program was called

X

None

Triggers a runtime error with short dump

This context includes all situations where a screen is being processed, that is, the program is reacting to user input. In ABAP programs, this means all PAI modules.

Message Processing

Type

Display

Processing

A

Dialog box

Program terminates, and control returns to last area menu

E

Status bar

PAI processing is terminated, and control returns to the current screen. All of the screen fields for which there is a FIELD or CHAIN statement are ready for input. The user must enter a new value. The system then restarts PAI processing for the screen using the new values. Error messages are not possible in POH or POV processing. Instead, a runtime error occurs.

I

Dialog box

Program continues processing after the MESSAGE statement

S

Status bar of next screen

Program continues processing after the MESSAGE statement

W

Status bar

Like type E, but the user can confirm the message by pressing ENTER without having to enter new values. The system then resumes PAI processing directly after the MESSAGE statement. Warning messages are not possible in POH or POV processing. Instead, a runtime error occurs.

X

None

Triggers a runtime error with short dump

For further information about processing error messages and warnings in the PAI event, refer to Input Checks in Dialog Modules.

Messages have two different functions in function modules and methods:

Normal Messages

If you use messages in function modules and methods without the RAISING addition in the MESSAGE statement, and the caller does not catch the message, the message is handled normally according to the context in which it is called within the function module or method.

Triggering Exceptions with Messages

If you use messages in function modules and methods with the addition

... RAISING <exc>

the way in which the message is handled depends on whether the calling program handles the exception <exc> or not.

If the calling program does not handle the exception, the message is displayed and handled according to the context in which it occurs in the function module or method from which it was called.

If the calling program handles the exception, the message is not displayed. Instead, the procedure is interrupted in accordance with the message type, and processing returns to the calling program. The contents of the message are placed in the system fields SY-MSGID, SY-MSGTY, SY-MSGNO, and SY-MSGV1 to SY-MSGV4.

Catching Message in the Calling Program

You can catch messages from function modules that are not sent using the RAISING addition in the MESSAGE statement by including the implicit exception ERROR_MESSAGE in the EXCEPTIONS list of the CALL FUNCTION statement. The following conditions apply:

Type S, I, and W messages are ignored (but logged during background processing)

Type E and A messages trigger the exception ERROR_MESSAGE

Type X messages trigger the usual runtime error and short dump.

Catching messages is not currently supported for methods.

Read only

Former Member
0 Likes
3,059

hi ,

we can create our own message while generating screenpainter, reports anywhere where u will get some message (user friendly)

to create we have 2 ways ,,,1> direct t-code se91.

give the message class name : eg(ysample) and short description

there you can find 000 to 999 lines with blank where you can write 1000 message of 6 types ..Eg: message i000. in this way u can call this messge in your program... ensure that name Ysample message class name should be given at

starting Eg : report zscreen1 message-id ysample.

2>u can give here in editor the message-id ysample double click on it moves to se91. u can give the message and use the message

eg : message s001.

gives the status "and message u give in se91".