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

Displaying message from Tables

Former Member
0 Likes
1,641

Hi,

I have a requirement to display the message from the table.

The thing is I m maintaining message class, msg type and msg Id in custom table.

I need to code this in Loop and I m getting message class, msg type and msg Id dynamically from the custom tables

Please help me how to do this.

Thanks&Regards

Uday KIran

8 REPLIES 8
Read only

venkat_o
Active Contributor
0 Likes
1,585

Hi, <li>Pass those parameters inside LOOP-ENDLOOP to FORMAT_MESSAGE . It will give formatted message. Thanks Venkat.O

Read only

Former Member
0 Likes
1,585

Hi Venkat,

I m passing message Id and message class which parameter I have to use for message type parameter

Read only

venkat_o
Active Contributor
0 Likes
1,585

<li>You can check message type in the message internal table . Thanks Venkat.O

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,585

Just use a [MESSAGE|http://help.sap.com/abapdocu_70/en/ABAPMESSAGE.htm] [ID mid TYPE mtype NUMBER num|http://help.sap.com/abapdocu_70/en/ABAPMESSAGE_MSG.htm#!ABAP_ALTERNATIVE_3@3@] [WITH dobj1 ... dobj4|http://help.sap.com/abapdocu_70/en/ABAPMESSAGE_OPTIONS.htm#!ABAP_ADDITION_4@4@] [INTO text|http://help.sap.com/abapdocu_70/en/ABAPMESSAGE_OPTIONS.htm#!ABAP_ADDITION_3@3@]

MESSAGE ID wa-id TYPE wa-type NUMBER wa-number [WITH wa-field1 ... wa-field4] [INTO wa-text]

Regards,

Raymond

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,585

Try this way:

LOOP AT IT_MSG INTO WA_MSG.

"To display the Message
MESSAGE ID wa_msg-mid TYPE wa_msg-mtype NUMBER wa_msg-num.

"To get the Message Text
MESSAGE ID wa_msg-mid TYPE wa_msg-mtype NUMBER wa_msg-num INTO v_string.

ENDLOOP.

You do not need to use any FM to get the message text. SAP provides a standard addition MESSAGE ... INTO which does the same.

@Uday: As per your original post you have the Message Type with you in the internal table.

@Raymond: That was cool !!! You had the patience to do that formatting

BR,

Suhas

Edited by: Suhas Saha on Mar 3, 2010 3:18 PM

Read only

Former Member
0 Likes
1,585

Thanks for the helpful answer.

Again I have to pass this anywhere or is it enough

Read only

Former Member
0 Likes
1,585

Hi,

Keep in mind that the function module FORMAT_MESSAGE is not released by SAP, it would be much better to follow Raymond's suggestion.

(Actually, I think Raymond's is the better suggestion even if FORMAT_MESSAGE was released)

Regards,

Nick

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
1,585

>

> Again I have to pass this anywhere or is it enough

I don't understand your question !!!

When you use MESSAGE ... INTO <v_text>, the variable V_TEXT will contain the message text.

And in this case the message type does not effect the behavior of the program. Please read the F1 documentation on this.

@NIck: Rightly pointed out by you. Who wants to call an FM when a single line can do the job for you

Cheers,

Suhas

Edited by: Suhas Saha on Mar 3, 2010 3:34 PM