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

Error Message

Former Member
0 Likes
1,791

Hi,

I wanted to write some error message.

Is it necessary to write the message id.

suppose i would like to write

if sy-subrc <> 0.

message 'Error' with 'E'.

endif.

Anybody will pls tell me the different ways to write error messages??

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,431

Hi.....

a message statement can be written in multiple ways..

1.create a msg class in SE91

MESSAGE E000(message-class name) WITH <MSG TEXT>.

u can include a maximum of 4 place holders.

2. create a msg class in SE91 and include the name in the report header

Report YTEST MESSAGE-ID YMSG.

MESSAGE E100 WITH <MSG TEXT>.

Here the message 100 from message class YMSG will be displayed.

3. MESSAGE 'Message text' type 'E'.

here the first two methods are almost same and

the difference between the first two and the third is :

In the first two methods the messages are global. we can create a message in SE91 and use the same message in any number of programs but this is not the case with the third method.

Let me know if you have any more doubt.

Reward points if useful......

Suresh......

6 REPLIES 6
Read only

Former Member
0 Likes
1,431

one of the ways is

1.MESSAGE e000(oo) WITH '<MSG TEXT>'.

u can include a maximum of 4 place holders.

2.other is to create a msg class in SE91 and include the name in the report header, like this

REPORT z_myreport MESSAGE-ID <msg class>.

MESSAGE <msg type><msg number>.

Read only

Former Member
0 Likes
1,431

hi,

hi here is some infor firts u have to create a msg class in se91 then give some msg which u want to use after that in main pgm declare it in the first line and use it where u want to use

there are diff class of erros msg like

E-error

X-exit

A-abort

I-information

W-warning

Report zpgm <b>MESSAGE-ID ZMSG.</b>

.....................

....................

if sy-subrc <> 0.

message E000. (this is an error msg bcoz i am using E )

endif.

...................

.....................

if this helps u reward points

ravi

Read only

Former Member
0 Likes
1,431

Hi..,

You can write the message even without message id also..

1)MESSAGE 'Message text ' TYPE 'E'.

E should always be in Capital letters..

2) Message e001(mesgid).

3) Message e001(mesgid) with V1 V2 V3 V4.

u can use onli 4 place holders..

Plz do remember to close the thread, when your problem is solved !!

reward all helpful answers,

sair amesh

Read only

Former Member
0 Likes
1,431

Hi,

You can write Like this:

MESSAGE ID 'ZM_MSG' TYPE 'E' NUMBER '000' WITH

'You can create a Purchase order' 'only with reference to a PR or RFQ'.

or

message E000(VS) with 'Invalid So number'.

no need to give message class VS along with message if you declare in the top along with REPORT..<name> message-ID VS.

reward if useful

regards,

ANJI

Read only

Former Member
0 Likes
1,431

hi,

ur can write msg by specfing them with ID by creating them in se91

or by the following way.

MESSAGE 'ERROE' TYPE 'I'.

TYPE OF MESSAGE SHOULD BE IN CAPS..

OK..

HOPE THIS SOLVE U RPROBLEM.

Read only

Former Member
0 Likes
1,432

Hi.....

a message statement can be written in multiple ways..

1.create a msg class in SE91

MESSAGE E000(message-class name) WITH <MSG TEXT>.

u can include a maximum of 4 place holders.

2. create a msg class in SE91 and include the name in the report header

Report YTEST MESSAGE-ID YMSG.

MESSAGE E100 WITH <MSG TEXT>.

Here the message 100 from message class YMSG will be displayed.

3. MESSAGE 'Message text' type 'E'.

here the first two methods are almost same and

the difference between the first two and the third is :

In the first two methods the messages are global. we can create a message in SE91 and use the same message in any number of programs but this is not the case with the third method.

Let me know if you have any more doubt.

Reward points if useful......

Suresh......