‎2010 Mar 03 9:35 AM
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
‎2010 Mar 03 9:39 AM
Hi, <li>Pass those parameters inside LOOP-ENDLOOP to FORMAT_MESSAGE . It will give formatted message. Thanks Venkat.O
‎2010 Mar 03 9:45 AM
Hi Venkat,
I m passing message Id and message class which parameter I have to use for message type parameter
‎2010 Mar 03 9:51 AM
<li>You can check message type in the message internal table . Thanks Venkat.O
‎2010 Mar 03 9:43 AM
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
‎2010 Mar 03 9:47 AM
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
‎2010 Mar 03 9:56 AM
Thanks for the helpful answer.
Again I have to pass this anywhere or is it enough
‎2010 Mar 03 9:59 AM
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
‎2010 Mar 03 10:01 AM
>
> 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