2013 Sep 14 8:24 PM
I use BDC session method to upload data. But during upload some error records are found which are stored in LOG file.
My requirement is how to get these error records from the session log file and again I want to store these error records in a z table.
Please suggest me how to solve this requirement ?
Regards,
Ajit
2013 Sep 16 10:11 AM
Hi,
Please find the link below for error handling.
http://abap-technical.blogspot.in/2008/06/bdc-call-transaction-pgm-with-error.html
http://saptechnical.com/Tutorials/ABAP/BDC/Session2.htm
http://scn.sap.com/thread/920327
Thanks
Vijay
Hi,
Please find the link below for error handling.
http://abap-technical.blogspot.in/2008/06/bdc-call-transaction-pgm-with-error.html
http://saptechnical.com/Tutorials/ABAP/BDC/Session2.htm
http://scn.sap.com/thread/920327
Thanks
Vijay
2013 Sep 15 5:46 AM
Hi ,
In session method I have no IDEA, But if you use Call transaction It can achieved.
In that when you write
CALL TRANSACTION 'CR01' USING I_BDCDATA
MODE W_MODE
UPDATE 'S'
MESSAGES INTO I_MSG.
then sy-subrc check.
After this Loop in I_msg.
LOOP AT I_MSG INTO WA_MSG WHERE MSGTYP EQ 'E'.
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
MSGID = WA_MSG-MSGID
MSGNR = WA_MSG-MSGNR
MSGV1 = WA_MSG-MSGV1
MSGV2 = WA_MSG-MSGV2
MSGV3 = WA_MSG-MSGV3
MSGV4 = WA_MSG-MSGV4
IMPORTING
MESSAGE_TEXT_OUTPUT = W_MSG1.
WA_OUTPUT-MSG_ERR = W_MSG1.
WA_OUTPUT-LINE_NO = GV_INDEX.
MODIFY WA_OUTPUT TO ZABDC. "Your ztable name.
In case of internal table you can use APPEND / MODIFY.
APPEND WA_OUTPUT TO I_OUTPUT.
In this way you can store that error file.
You also download that one Using GUI_DOWNLOAD.
Search in web for other help.
Hope it helps.
Thanks
Gourav.
2013 Sep 15 6:27 AM
Hi Ajit,
Declare the internal table that is used to finally collect the error records from the BDC session log.
TYPES : BEGIN OF ty_s_error,
msg_err(60) TYPE c,
END OF ty_s_error.
it_output type table of ty_s_error,
wa_output like line of it_output.
To create Log for the Error Message in BDC, we use structure BDCMSGCOLL.
DATA:
t_msg TYPE TABLE OF bdcmsgcoll, " Collecting Error messages
w_msg TYPE bdcmsgcoll,
w_msg1(51).
w_mode TYPE c.
* Mode 'A' = Foreground mode
* Mode 'N' = Background mode
w_mode = 'A'.
CALL TRANSACTION 'ME51' USING t_bdcdata
MODE w_mode
UPDATE 'S'
MESSAGES INTO t_msg.
IF sy-subrc EQ 0.
* Uploaded into the database
WRITE 😕 'DATA UPLOADED IN TABLE EBAN...' .
ELSE.
* Error Found
LOOP AT t_msg INTO w_msg WHERE msgtyp EQ 'E'.
* Format Message
CALL FUNCTION 'MESSAGE_TEXT_BUILD'
EXPORTING
msgid = w_msg-msgid
msgnr = w_msg-msgnr
msgv1 = w_msg-msgv1
msgv2 = w_msg-msgv2
msgv3 = w_msg-msgv3
msgv4 = w_msg-msgv4
IMPORTING
message_text_output = w_msg1.
wa_output-msg_err = w_msg1.
* Add any additional details if required
data:
wa_string(10) type c.
wa_string = fs_field-matnr.
concatenate wa_string wa_output-msg_err into wa_output-msg_err separated by space.
APPEND wa_output-msg_err TO it_output.
ENDLOOP.
ENDIF.
Now you can used this table it_output to update your database table with the messages.
Regards,
Susmitha
2014 Nov 25 8:44 AM
in bdc program i am getting message output for all screen , where as i want only success and failure message ..
bdc recording for mm01
my code is \
CALL TRANSACTION 'MM01'
USING bdcdata
MODE bmode
MESSAGES INTO messtab .
CLEAR bdcdata.
REFRESH bdcdata.
CLEAR: IT_FINAL,g_msg.
LOOP AT messtab.
CLEAR: g_msg.
CALL FUNCTION 'FORMAT_MESSAGE'
EXPORTING
ID = messtab-msgid
LANG = messtab-msgspra
NO = messtab-msgnr
V1 = messtab-msgv1
V2 = messtab-msgv2
V3 = messtab-msgv3
V4 = messtab-msgv4
IMPORTING
MSG = g_msg
EXCEPTIONS
NOT_FOUND = 1
OTHERS = 2.
WRITE:/ G_MSG.
ENDLOOP.
CLEAR: messtab,G_MSG.
REFRESH:messtab.
ENDLOOP.
2013 Sep 15 2:09 PM
Hi @ Gaurav and @ Susmita,
Thank you for your response.
But My requirement is not for BDC call transaction error records, its for BDC session method. The errors are inside log file of SM35 transaction code. So I want to fetch data from the log file and save in database.
Regards,
Ajit
2013 Sep 15 4:33 PM
H Ajit,
It is better to use CALL TRANSACTION to get the error.
However if you want to get the error from the session log, use this method.
http://wiki.scn.sap.com/wiki/display/ABAP/Get+log+of+batch+input+session
Thanks,
Susmitha
2013 Sep 15 4:17 PM
2013 Sep 16 9:51 AM
Use the search tool, there are already some sample in wiki section of the site with reports that extract session log.
Regards,
Raymond
2013 Sep 16 10:11 AM
Hi,
Please find the link below for error handling.
http://abap-technical.blogspot.in/2008/06/bdc-call-transaction-pgm-with-error.html
http://saptechnical.com/Tutorials/ABAP/BDC/Session2.htm
http://scn.sap.com/thread/920327
Thanks
Vijay
2013 Sep 18 2:44 PM
| User | Count |
|---|---|
| 4 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |