‎2007 Oct 10 7:29 AM
hii i am a new employee.
can anyone please explain wat the following code is doing
IF sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH wa_messtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH wa_messtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH wa_messtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH wa_messtab-msgv4 INTO l_mstring.
ELSE.
REPLACE '&' WITH wa_messtab-msgv1 INTO l_mstring.
REPLACE '&' WITH wa_messtab-msgv2 INTO l_mstring.
REPLACE '&' WITH wa_messtab-msgv3 INTO l_mstring.
REPLACE '&' WITH wa_messtab-msgv4 INTO l_mstring.
ENDIF.
CONDENSE l_mstring.
i am supposed to use a function module for it
i have got a function module.
but i am not understanding wat fields shd i put in it
the function module is
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid =
msgnr =
MSGV1 = ' '
MSGV2 = ' '
MSGV3 = ' '
MSGV4 = ' '
IMPORTING
MESSAGE_TEXT_OUTPUT =
can anyone tell wat shd i put on msgid ,msgnr and other fields.
saurabh102@gmail.com
‎2007 Oct 10 8:06 AM
The meaning of the code is
t100 is a message table.
getting a message text from the message table.
if the message text contains '&1'
then replace &1 with msgv1
.....................................&2................................msgv2
so on.
if it does not contain &1 &2 buit contains only & then
replcace & with msgv1 and msgv2 so on according to the position of the &.
in general
If there is only one & it is replaced with msgv1.
2nd position with msgv2 , 3rd & with msgv3 4th with msgv4.
observe t1000 table and also go to se91 transaction and obseve.
&1...&4 will be replaced with sy-msgv1...sy-msgv2.
in ur report u can fill the fn module like below
the function module is
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = < enter the message class>
msgnr = < enter the message number
MSGV1 = wa_messtab-msgv1
MSGV2 = wa_messtab-msgv2
MSGV3 = wa_messtab-msgv3
MSGV4 = wa_messtab-msgv4
IMPORTING
MESSAGE_TEXT_OUTPUT = l_mstring.
‎2007 Oct 10 8:19 AM
HI,
TRY LIKE THIS
1. DECLARE A INTERNAL TABLE WITHOUT HEADER LINE AND WORKAREA AS
DATA: MESSTAB LIKE ........... OCCURS 0,
WA_MESSTAB LIKE ................ . " USE A STANDARD DATABASE TABLE ACCORDING TO UR SPEC
DATA: L_MSTRING TYPE T100-TEXT.
F sy-subrc = 0.
l_mstring = t100-text.
IF l_mstring CS '&1'.
REPLACE '&1' WITH wa_messtab-msgv1 INTO l_mstring.
REPLACE '&2' WITH wa_messtab-msgv2 INTO l_mstring.
REPLACE '&3' WITH wa_messtab-msgv3 INTO l_mstring.
REPLACE '&4' WITH wa_messtab-msgv4 INTO l_mstring.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = " GIVE ANY STRING OF LENGTH 30 CHARACTERS'
msgnr = " GIVE ANY STRING OF LENGTH 30 CHARACTERS'
MSGV1 = ' '
MSGV2 = ' '
MSGV3 = ' '
MSGV4 = ' '
IMPORTING
MESSAGE_TEXT_OUTPUT =
FOR THE ABOVE 2 PARAMETERS GOTO THAT FM -> IMPORT PARAMETERS SECTION -> CLICK ON F1 HELP -> TECHNICAL INFO -> DOUBLE CLICK ON DATA ELEMENT.
IF HELPFUL REWARD SOME POINTS.
WITH REGARDS,
SURESH ALURI.
‎2007 Oct 10 8:45 AM
Hi saurabh,
SAP loves ikt to make simple tasks complicated and time-consuming.
why not simplify:
data:
lv_msg type string.
message ID wa_messtab-msgid
TYPE wa_messtab-msgty
NUMBER wa_messtab-msgno
WITH
wa_messtab-msgv1
wa_messtab-msgv2
wa_messtab-msgv3
wa_messtab-msgv4
INTO lv_msg.I don't know what your task is. T100 is useful to search with SE16 if you want to find a message. You never need it in a program.
If you want a message text (in logon language) just used MESSAGE ... INTO.
Regards,
Clemens