‎2006 Dec 04 5:55 AM
How does the Errors in BDC Call Transactin is captured ....can you please give same examples of using BDCMSGCOLL and FORMAT_MESSAGES..
Please explain clearly when to used these in real time..
Thankyou
‎2006 Dec 04 6:14 AM
The syntax is -
call transaction <t_code> using <bdc_table> mode <A/E/N> update <A/S> messages into <it_messages>.
this it_messages has to be of type BDCMSGCOLL.
You can see the structure of the BDCMSGCOLL and read the messages accordingly.
Basically, the errors are logged automatically when we create a batch input session and execute the session, while in case of Call Transaction .. it is not so.. hence we use this method of storing the messages into the internal table.
After the call transaction ... You can loop on this internal table and see the messages.
It will give you all the details like the message type - Error, warning , Info or abend.
the message is split into 4 parts...
hope this helps.
Plz reward points if this helps you.
Fell free to come back is some doubts are still unsolved.
‎2006 Dec 04 6:17 AM
Check this example from the documentation:
DATA: BDCDATA TYPE TABLE OF BDCDATA.
DATA: ITAB TYPE TABLE OF BDCMSGCOLL.
DATA: PROGRAM LIKE SY-REPID,
WA_BDCDATA TYPE BDCDATA.
WA_BDCDATA-PROGRAM = 'SAPMS38M'.
WA_BDCDATA-DYNPRO = '0100'.
WA_BDCDATA-DYNBEGIN = 'X'.
APPEND WA_BDCDATA TO BDCDATA.
CLEAR WA_BDCDATA.
WA_BDCDATA-FNAM = 'RS38M-PROGRAMM'.
WA_BDCDATA-FVAL = PROGRAM.
APPEND WA_BDCDATA TO BDCDATA.
...
CALL TRANSACTION 'SE38' USING BDCDATA MODE 'N'
MESSAGES INTO ITAB.
Now formatting messages:
loop at itab.
perform format_message USING itab-msgid itab-msgnr itab-msgv1 itab-msgv2 itab-msgv3 itab-msgv4.
endloop.
FORM FORMAT_MESSAGE USING P_MSGID LIKE SY-MSGID
P_MSGNO LIKE SY-MSGNO
P_MSGV1 LIKE SY-MSGV1
P_MSGV2 LIKE SY-MSGV2
P_MSGV3 LIKE SY-MSGV3
P_MSGV4 LIKE SY-MSGV4.
DATA: P_TEXT(100) TYPE C.
CLEAR: P_TEXT.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = P_MSGID
LANG = SY-LANGU
NO = P_MSGNO
V1 = P_MSGV1
V2 = P_MSGV2
V3 = P_MSGV3
V4 = P_MSGV4
IMPORTING
MSG = P_TEXT
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
IF SY-SUBRC EQ 0.
WRITE:/ P_TEXT.
ENDIF.
ENDFORM. " FORMAT_MESSAGEHope this helps.
Kind Regards
Eswar
‎2006 Dec 05 4:09 PM
hi,
Here is hte sample code
call transaction 'ME22' using it_bdc
options from x_ctu_params
messages into lt_message.
clear w_success.
if sy-subrc <> 0.
w_success = 'N'.
endif.
loop at lt_message where msgtyp = 'E' or
msgtyp = 'A'.
endloop.
if sy-subrc = 0.
perform format_messages tables lt_message
using lv_msg lv_lines.
* To append error messages
perform append_message tables lt_message
return
using lv_msg.
else.
if w_success = 'N'.
perform format_messages tables lt_message
using lv_msg lv_lines.
perform append_message_err tables lt_message
return
using lv_msg.
else.
perform format_messages tables lt_message
using lv_msg lv_lines.
* To append success messages
perform append_message tables lt_message
return
using lv_msg.
endif.
endif.
refresh: it_bdc,
lt_message.
endat.
endloop.
endif.
form format_messages tables pt_messages structure bdcmsgcoll
using pv_msg pv_lines.
clear : pv_lines,pt_messages,pv_msg.
describe table pt_messages lines pv_lines.
read table pt_messages index pv_lines.
check not pt_messages-msgid is initial.
*-- Function module to format the message given
call function 'FORMAT_MESSAGE'
exporting
id = pt_messages-msgid
lang = sy-langu
no = pt_messages-msgnr
v1 = pt_messages-msgv1
v2 = pt_messages-msgv2
v3 = pt_messages-msgv3
v4 = pt_messages-msgv4
importing
msg = pv_msg
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 into pv_msg.
endif.
endform. " format_messages
Regards,
Richa
‎2006 Dec 05 7:54 PM
Hi,
Also, it is a usual procedure to create a session for all the error records. This enables the user to rectify the records online.
Regards,
Vara