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

How to write message.

Former Member
0 Likes
7,181

Hello Experts,

I have a done report where I have made a bapi.

In this BAPI when Order number is passed I get the message. like order no 501 is saved

But when my order no is not relevant I need to get a meesage like:

Order No 50000 is not relevant.

Order no= itab-aufnr.

I am only writing message as:

MESSAGE 'ORDER NO NOT RELEVANT FOR BAPI' TYPE 'I'.

Over here how can I pass itab-aufnr is message?

Thanks and Regrds,

Nikhil.

7 REPLIES 7
Read only

Former Member
0 Likes
2,063

Hi,

MESSAGE 'ORDER NO' itab-aufnr 'NOT RELEVANT FOR BAPI' TYPE 'I'.

-Rajneesh Gupta

Read only

0 Likes
2,063

Hi,

You can also pass '&' in text element .

ex: MESSAGE e999 WITH w_error1 w_error2 w_error3.

w_error1 = ' Order No."

w_error2 = itab-aufnr.

w_error3 = 'Not relevant for BAPI'.

Thanks,

Aravind

Read only

Former Member
0 Likes
2,063

Hi,

Go to se91 and create a message in one of the existing message classes or create a new message class create message like below with '&' signs.

you cna have upto four "&" signs which are actual place holders for messages

then call message in your prorgam like below:



message i000(zz) with 'ORDER NO NOT RELEVANT FOR BAPI'  itab-aufnr .

Try F1 help on key word message for more info

Regards,

Himanshu

Read only

Former Member
0 Likes
2,063

Hi

Please check this.

DATA: mid TYPE sy-msgid VALUE 'SABAPDOCU',

mtype TYPE sy-msgty VALUE 'I',

num TYPE sy-msgno VALUE '014'.

MESSAGE ID mid itab-value TYPE mtype NUMBER num.

or

MESSAGE 'Message in a Method' itab-value TYPE 'I' RAISING exc1.

please try F1 help on 'Message' , you will surely get better options.

Read only

sreeramkumar_madisetty
Active Contributor
0 Likes
2,063

Hi

Which BAPI you are using for?

If you are using Standard BAPI,then BAPI itself will throw the error message if the BAPI contains the Exceptions section.

Regards,

Sreeram

Read only

Former Member
0 Likes
2,063

Hi,

From abap editor se38->goto->messages.

create a message in zclass say ' Order No &1 is not relevant'.

write code as

here z_tezt- msg class,

000- msg number

w_str -order no.


message id 'Z_TEST' type 'I' number '000' with w_str .

Regards,

Deeba

Read only

Former Member
0 Likes
2,063

solved thanks