Application Development 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: 

How to get Message Text from Internal table

Former Member
0 Kudos
1,320

Hi ,

Can any body tell me,

I have an internal table , which is having MsgID, MsgNR,msg-var1,msg-var2,msg-var3,msg-var4.

I need to get the message text from these fields. please give me suggession.

thanks in advance.

kp

10 REPLIES 10

Former Member
0 Kudos
565

Hi,

loop at itab where msgnr = 'XXX' and

msgid = 'zz'.

conacatenate itab-msg-var1 itab-msg-var1 itab-msg-var1 itab-msg-var1

into msg_text.

endloop.

regards,

keerthi

0 Kudos
565

Use the function modules FORMAT_MESSAGE or MESSAGE_TEXT_BUILD.

~Suresh

amit_khare
Active Contributor
0 Kudos
565

Loop at itab into w_tab where msgid = v_id.

CALL FUNCTION 'FORMAT_MESSAGE'

  • EXPORTING

  • ID = w_itab-msgid

  • LANG = '-E'

  • NO = w_tab-msgnr

  • V1 = w_tab-msg-var2

  • V2 = w_tab-msg-var2

  • V3 = w_tab-msg-var3

  • V4 = w_tab-msg-var4

  • IMPORTING

  • MSG =

  • EXCEPTIONS

  • NOT_FOUND = 1

  • OTHERS = 2 .

endloop.

Regards,

Amit

Reward all helpful replies.

Former Member
0 Kudos
565

KP,

Pls. check the fM.

CALL FUNCTION 'FORMAT_MESSAGE'

EXPORTING

ID = MSG_LST-MSGID

LANG = SY-LANGU

NO = MSG_LST-MSGNO

V1 = MSG_LST-MSGV1

V2 = MSG_LST-MSGV2

V3 = MSG_LST-MSGV3

V4 = MSG_LST-MSGV4

IMPORTING

MSG = MSG_TEXT

EXCEPTIONS

NOT_FOUND = 01.

Pls. reward if useful

Former Member
0 Kudos
565

CHECK MSG-VAR1 TO VAR4 IN DEBUG MODE GENERALLY TEXTS ARE STORED IN THIS VAR1 AREA.

REGARDS

SGHIBA DUTTA

Former Member
0 Kudos
565
also try this..

CALL FUNCTION 'TB_MESSAGE_BUILD_TEXT'
       EXPORTING
            LANGU = SY-LANGU
            MSGID = P_SY_MSGID
            MSGNO = P_SY_MSGNO
            MSGV1 = P_SY_MSGV1
            MSGV2 = P_SY_MSGV2
            MSGV3 = P_SY_MSGV3
            MSGV4 = P_SY_MSGV4
       IMPORTING
            TEXT  = P_L_ERR_MSG.

Former Member
0 Kudos
565

CHECK MSG-VAR1 TO VAR4 IN DEBUG MODE GENERALLY TEXTS ARE STORED IN THIS VAR1 AREA.

REGARDS

SGHIBA DUTTA

Former Member
0 Kudos
565

Hi,

Use FORMAT_MESSAGE to get the description of text for the message number.

Thanks

Hari.

Reward points for valuable answers.

Former Member
0 Kudos
565

hi

good

if you r having these fields in your internal table than debug the program what value they are storing and if you want to print then you can use the write statement to print those values in the output screen.

or you can pass these field values to any of your defined variable and you can display them using the write statement.

thanks

mrutyun^

Former Member
0 Kudos
565

Hi KP,

Use the following code to get the Message text for the MsgID, MsgNo, MsgV1-V4.

TABLES : T100 .

SELECT SINGLE * FROM T100 WHERE SPRSL = SY-LANGU AND

ARBGB = MSGID AND

MSGNR = MSGNO .

TEXT = T100-TEXT .

REPLACE '&1' WITH MSGV1 INTO TEXT . CONDENSE TEXT .

REPLACE '&2' WITH MSGV2 INTO TEXT . CONDENSE TEXT .

REPLACE '&3' WITH MSGV3 INTO TEXT . CONDENSE TEXT .

REPLACE '&4' WITH MSGV4 INTO TEXT . CONDENSE TEXT .

REPLACE '&' WITH MSGV1 INTO TEXT . CONDENSE TEXT .

REPLACE '&' WITH MSGV2 INTO TEXT . CONDENSE TEXT .

REPLACE '&' WITH MSGV3 INTO TEXT . CONDENSE TEXT .

REPLACE '&' WITH MSGV4 INTO TEXT . CONDENSE TEXT .

Hope it helps.

Regards,

Himanshu.