02-21-2007 5:54 AM
Hi Gurus,
I am running transaction QP01 using call transaction method like
CALL TRANSACTION 'QP01' USING bdcdata MODE 'N' UPDATE 'S' MESSAGES INTO messtab.
If i use wrong data and in the A mode my messtab is getting error messages ,
but if i use n mode am not getting any error messages in my messtab internal table and the data is not stored in the Transaction..
I need that error messages.
Help me ...
Regards,
Ashok...
02-21-2007 5:59 AM
Hi
Write the below code, you will get the errors. you need to write the Loop at MEsstab after the Call transaction step
CALL TRANSACTION 'QP01' USING bdcdata MODE 'N' UPDATE 'S' MESSAGES INTO messtab.
Loop at MESSTAB.
write: MESSTAB-MSGV1,MESSTAB-MSGV2,MESSTAB-MSGV3,MESSTAB-MSGV4
Endloop.
Regards
Sudheer
02-21-2007 6:02 AM
Thanks Sudheer ,
No Error data is getting populated in my messtab,then hoe i coud loop it up and display that.
Regards,
Ashok...
02-21-2007 6:03 AM
Hi
Declare strucutre like bdcmsgcoll
Call function module Format_message.
Thanks
02-21-2007 6:04 AM
Hi,
Use this example for help.
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.
regards
Gaurav
02-21-2007 6:06 AM
Hi Gaurav ,
I am not getting any error messages in my messtab then hoe to loop it up....
Regards,
Ashok....
02-21-2007 6:11 AM
Ashok,
Try this this will help you.
DATA: i_messages LIKE bdcmsgcoll OCCURS 0.
CALL TRANSACTION tcode USING i_bdcdata
MODE lws_mode
UPDATE lws_update
MESSAGES INTO i_messages.
Here the error and success messages have come into the table i_messages
Now this is not complete if you look at the table i_messages at runtime...
Now to get the complete message you use the FORMAT_MESSAGE.
LOOP AT i_messages INTO wa_messages
WHERE msgtyp EQ 'E' OR
msgtyp EQ 'A'. (This is to get only Error Messages)
call function 'FORMAT_MESSAGE'
exporting
id = wa_messages-msgid
lang = sy-langu
no = wa_messages-msgnr
v1 = wa_messages-msgv1
v2 = wa_messages-msgv2
v3 = wa_messages-msgv3
v4 = wa_messages-msgv4
importing
msg = v_msg
exceptions
not_found = 1
others = 2.
Here v_msg contains the full error message such that you would see on the screen.
wa_error-message = v_msg.
append wa_error to i_error.
Here your table i_error will contain all the error messages which have come
ENDLOOP.
Pls. Mark if useful