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

Extracting Long text from message class with parameters

Former Member
0 Likes
3,062

Hi,

I would like to extract the long text from a message class. However, the long text has 4 parameters and I have to retrieve them after they have been replaced by the actual parameters. Is there any Function Module/Class that would help me in doing this operation?

Thanks and regards,

Ritesh

1 ACCEPTED SOLUTION
Read only

Sandra_Rossi
Active Contributor
0 Likes
2,502

function module FORMAT_MESSAGE should not be used anymore as an ABAP statement exists (since a very long time now):

MESSAGE ... WITH <parameters> INTO variable.

Hi,

I would like to extract the long text from a message class. However, the long text has 4 parameters and I have to retrieve them after they have been replaced by the actual parameters. Is there any Function Module/Class that would help me in doing this operation?

Thanks and regards,

Ritesh

9 REPLIES 9
Read only

Former Member
0 Likes
2,502

Hi,

data : wa_msgtab TYPE bdcmsgcoll,

ist_msgtab TYPE table of bdcmsgcoll.

you need to capture these message in CALL TRANSACTION statement of BDC

loop at ist_msgtab into wa_msgtab.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

id = wa_msgtab-msgid

lang = sy-langu

no = wa_msgtab-msgnr

v1 = wa_msgtab-msgv1

v2 = wa_msgtab-msgv2

v3 = wa_msgtab-msgv3

v4 = wa_msgtab-msgv4

IMPORTING

msg = g_errmsg

EXCEPTIONS

not_found = 1

OTHERS = 2.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

endloop.

The above FM returns all the values required , now you can concatenate all these values into a String and pass them to WebDynpro Component by using SET_ATTRIBUTE method of WD_CONTEXT

For more info go throught the Interface referring to WD_CONTEXT

Cheers

Ram

Edited by: Ramchander Krishnamraju on Oct 26, 2009 5:54 AM

Read only

Sandra_Rossi
Active Contributor
0 Likes
2,503

function module FORMAT_MESSAGE should not be used anymore as an ABAP statement exists (since a very long time now):

MESSAGE ... WITH <parameters> INTO variable.

Read only

0 Likes
2,502

Hi,

I cannot use MESSAGE statement as I have to display the long text within a WebDynPro component.

Thanks and regards,

Ritesh

Read only

0 Likes
2,502

Sorry, I reacted to the previous message, which did not answer to your question (note also that MESSAGE ... INTO variable do not send message to dynpro, but store SHORT message text into a variable, so you could use it if you wanted to retrieve the SHORT text).

For the LONG text (your question), search the forum (BAPI_MESSAGE_GETDETAIL, RPY_MESSAGE_COMPOSE, etc.)

Read only

0 Likes
2,502

Thanks a lot

Read only

Sm1tje
Active Contributor
0 Likes
2,502

Ritesh,

althought question is already marked as answered, I would like to make an additional remark. In WebDynpro, one should use the message manager for issueing messages.

Read only

0 Likes
2,502

Hi,

Yes, I do use the message manager. However, I still have to extract the Long text from the message class to use it within the message manager.

Thanks and regards,

Ritesh

Read only

Sm1tje
Active Contributor
0 Likes
2,502

Maybe it's just me, but I don't really understand. There is a method called: REPORT_T100_MESSAGE. In here you only have to pass the message class, number, type and placeholders and the message will be formatted and issued for you. I guess you are using another method, but not sure why.

Read only

0 Likes
2,502

Hi Micky,

I believe T100 is only for the short text and not for the long texts. Please correct me if I am wrong.

Thanks and regards,

Ritesh