‎2007 May 03 8:12 AM
hi,
I have generated one internal table for displaying error message using BDCMSGCOLL, i want the the error to display according to the field name,
Hw can i get it...
ex: <Material name> Error message as name already created or unit doesnt exit...
Pls reply,
Regards,
Divi.
‎2007 May 03 8:16 AM
hi,
while displaying error message write your internal table filed also.
i.e. loop at itab.
performs...
call transaction ...
if sy-subrc <> 0.
write : itab-materialname.
LOOP AT bdcmsg.
WRITE: bdcmsg-DYNAME,
bdcmsg-DYNUMB,
bdcmsg-MSGTYP,
bdcmsg-MSGSPRA,
bdcmsg-MSGID,
bdcmsg-MSGNR,
bdcmsg-MSGV1,
bdcmsg-MSGV2,
bdcmsg-MSGV3,
bdcmsg-MSGV4.
ENDLOOP.
endif.
endloop.
if helpful reward points
‎2007 May 03 8:14 AM
in some times , SAP will through the errors without field names.In this case u have to educate ur Users.
Regards
Prabhu
‎2007 May 03 8:15 AM
you must be doing a call transaction within a loop of (for examples) materials internal table.
once you get the messages, after the call transaction statements, concatenate the material name (or whatever you want to concatenate) in the msgv1 field of the message structure...
should work through such a workaround. try it
regards,
Priyank
‎2007 May 03 8:16 AM
hi,
while displaying error message write your internal table filed also.
i.e. loop at itab.
performs...
call transaction ...
if sy-subrc <> 0.
write : itab-materialname.
LOOP AT bdcmsg.
WRITE: bdcmsg-DYNAME,
bdcmsg-DYNUMB,
bdcmsg-MSGTYP,
bdcmsg-MSGSPRA,
bdcmsg-MSGID,
bdcmsg-MSGNR,
bdcmsg-MSGV1,
bdcmsg-MSGV2,
bdcmsg-MSGV3,
bdcmsg-MSGV4.
ENDLOOP.
endif.
endloop.
if helpful reward points
‎2007 May 03 8:20 AM
call transaction 'MI01' using itab_bdcdata mode 'A' MESSAGES INTO
ITAB_msg.
CLEAR itab_bdcdata[].
loop at itab_msg where msgtyp = 'S'. (u can give yiur msg type here)
break-point.
message i010(zmgs) with itab_msg-MSGV1.
docno = itab_msg-msgv1.
endloop.
‎2007 May 03 8:35 AM
Hi,
Thnk u i got it, but
I want along with the error message,
Now i am getting it field name seperate and error message seperate.
‎2007 May 03 6:39 PM
use FM 'MESSAGE_PREPARE'.
u will get it as error message itself...
‎2007 May 03 8:19 AM
Hi Divya,
Go to the program BDCRECX1 and check for the code :
LOOP AT MESSTAB.
SELECT SINGLE * FROM T100 WHERE SPRSL = MESSTAB-MSGSPRA
AND ARBGB = MESSTAB-MSGID
AND MSGNR = MESSTAB-MSGNR.
IF SY-SUBRC = 0.
L_MSTRING = T100-TEXT.
IF L_MSTRING CS '&1'.
REPLACE '&1' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&2' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&3' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&4' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ELSE.
REPLACE '&' WITH MESSTAB-MSGV1 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV2 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV3 INTO L_MSTRING.
REPLACE '&' WITH MESSTAB-MSGV4 INTO L_MSTRING.
ENDIF.
CONDENSE L_MSTRING.
WRITE: / MESSTAB-MSGTYP, L_MSTRING(250).
ELSE.
WRITE: / MESSTAB.
ENDIF.
ENDLOOP.
Hope this will solve your problem.
Reward if it helps.
Regards,
Hemant.
‎2007 May 03 8:19 AM
Hi,
just have a look at the table BDCMSGCOLL in SE11.
check the fields in that
data itab like BDCMSGCOLL occurs 0 with header line.
call transaction 'mk01' messages into itab.
loop at itab.
write : / itab-fldname.
endloop.
reward if useful
Regards,
Prajith
‎2007 May 03 8:24 AM
Hi Divya,
Try the below
CALL TRANSACTION 'MM01'
USING bdcdata
MODE 'N'
MESSAGES INTO MSGTAB.
IF SY-SUBRC NE 0.
move itab-matnr to jtab-matnr.
append jtab.
PERFORM CHECK.
ENDIF.
FORM CHECK.
LOOP AT MSGTAB where msgtyp = 'E'.
read table jtab index sy-index.
write:/ jtab-matnr.
CALL FUNCTION 'MESSAGE_PREPARE'
EXPORTING
LANGUAGE = sy-langu
MSG_ID = MSGTAB-MSGID
MSG_NO = MSGTAB-MSGNR
MSG_VAR1 = MSGTAB-MSGV1(50)
MSG_VAR2 = MSGTAB-MSGV2(50)
MSG_VAR3 = MSGTAB-MSGV3(50)
MSG_VAR4 = MSGTAB-MSGV4(50)
IMPORTING
MSG_TEXT = L_MSG
EXCEPTIONS
FUNCTION_NOT_COMPLETED = 1
MESSAGE_NOT_FOUND = 2
OTHERS = 3
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
WRITE: L_MSG.
ENDLOOP.
ENDFORM.
- Satish
‎2007 May 03 6:34 PM
Divya,
Take another field of lenght error message plus material name together. do the concatenation of those two fields into one field and displayt that field it will have all together in one field itself
Siva