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 msg

Former Member
0 Likes
733

Hello there,

This is more or less like a follow up to my previous post.

I was told that I can store the msg as text like this:

MESSAGE ID '5r' TYPE 'e' NUMBER '125' INTO err_msg.

however, in the case of e125(5r), the error is

  • Error in write target file &

where after the & is supposed to be the file name.

My question is:

How can I pass in the file name to the code above so that the entire error msg and the file name would be stored in err_msg. Should I use a "with"?

Thanks a lot!

Regards,

Anyi

1 ACCEPTED SOLUTION
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
666

You must use the WITH extenstion.


MESSAGE ID '5r' TYPE 'e' NUMBER '125' <b>WITH <filename></b>
INTO err_msg.

<filename> can be a literal or a variable.

Regards,

Rich Heilman

5 REPLIES 5
Read only

RichHeilman
Developer Advocate
Developer Advocate
0 Likes
667

You must use the WITH extenstion.


MESSAGE ID '5r' TYPE 'e' NUMBER '125' <b>WITH <filename></b>
INTO err_msg.

<filename> can be a literal or a variable.

Regards,

Rich Heilman

Read only

Former Member
0 Likes
666

Hi

MESSAGE ID '5r' TYPE 'e' NUMBER '125' INTO err_msg.

Replace '&' with <filename> into err_msg.

or

MESSAGE ID '5r' TYPE 'e' NUMBER '125' WITH <filename> INTO err_msg.

Max

Read only

Former Member
0 Likes
666

Hi Anyi,

MESSAGE statement with WITH clause.

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

WITH V_FILENAME.

In your case this will be

<b>MESSAGE ID '5r' TYPE 'e' NUMBER '125' WITH V_FILENAME INTO err_msg.</b>

In your messages You need to use & to replace with the content of V_FILENAME.

The message should be like this in your messages window.

<b>E125 &</b>

Check this link for MESSAGE statement.

http://www.sts.tu-harburg.de/teaching/sap_r3/ABAP4/message.htm

Thanks,

Vinay

Read only

Former Member
0 Likes
666

Hi,

You need write like

MESSAGE ID '5r' TYPE 'E' NUMBER '125' WITH <File name> INTO err_msg.

Regards

Sudheer

Read only

ferry_lianto
Active Contributor
0 Likes
666

Hi,

You can try like this.

MESSAGE ID '5r' TYPE 'e' NUMBER '125' WITH <filename> INTO err_msg.

Regards,

Ferry Lianto