‎2009 May 27 1:00 PM
Hello friends,
Is it possible to create error log in session method, just like call transaction ( BDCMSGCOLL) . I want to create error log.
Is it possible or not, If possible how ?
Please let me know the answer.
Thanks,
Ajay
‎2009 May 27 1:05 PM
Hi
Why do u need to do it?
U can read the log in SM35 trx, if u need to print it in your report see the report RSBDC_ANALYSE in order to understand how to get the log
Max
‎2009 May 27 1:05 PM
Hi
Why do u need to do it?
U can read the log in SM35 trx, if u need to print it in your report see the report RSBDC_ANALYSE in order to understand how to get the log
Max
‎2009 May 27 1:12 PM
‎2009 May 27 1:15 PM
Dear Ajay,
You can have very detail error log in session method and you can find screen to screen flow. While in call transaction there is very limited error log. Check session in sm35 and you can see details of successful as wel as error records.
Hope this will help you.
If your problem is solved, then please mark it as answered.
Regards,
Vijay
‎2009 May 27 1:19 PM
Hello Vijay,
How can i create error log in session other than SM35 log.
Thanks,
Ajay
‎2009 May 27 1:29 PM
Hi Ajay again,
When you will debug sm35 by putting /h then you will find error record internal table . Please go into that and find out the exact table. This will help you to analyse. And you can use in your program for displaying error log.
Regards,
Vijay
‎2009 May 27 1:20 PM
Hi Ajay,
There s a table called BDCMSGCOLL. Declare an internal table of type bdcmsgcoll.
Loop it and capture the values.The values will be captured in the fields MSGV1,MSGV2,MSGV3 and MSGV4.
Once you get them print them out.
Much Regards,
Amuktha.
‎2009 May 27 1:24 PM
BDCMSGCOLL we are using in call transaction method with the statement CALL TRANSACTION
but here where we have to use BDCMSGCOLL ( i mean with which statement ) ?
Thanks,
Ajay
‎2009 May 27 1:31 PM
Hi,
* To catch no. of lines in itab.
DESCRIBE TABLE itab LINES trec.
* To catch no. of lines in it_err.
DESCRIBE TABLE it_err LINES erec.
* Calculation for records which are successfully uploaded.
srec = trec - erec.
* Layout for display summary begin.
WRITE:(60) sy-uline..
WRITE:/ sy-vline, ' SUMMARY OF TRANSACTION '
COLOR COL_HEADING,60 sy-vline..
WRITE:/(60) sy-uline..
WRITE:/ sy-vline, 'TOTAL NO. OF RECORDS ' COLOR
COL_TOTAL, 46 sy-vline, 50 trec LEFT-JUSTIFIED, 60 sy-vline.
WRITE:/(60) sy-uline.
WRITE:/ sy-vline, 'No Of Records Not Uploaded Successfully are:' COLOR
COL_NEGATIVE HOTSPOT ON,50 erec LEFT-JUSTIFIED, 46 sy-vline,60
sy-vline.
WRITE:/(60) sy-uline.
WRITE:/ sy-vline, 'No Of Records Uploded Successfully are: ' COLOR
COL_POSITIVE ,50 srec LEFT-JUSTIFIED,46 sy-vline,60 sy-vline.
WRITE:/(60) sy-uline.
* Function to create error file.
CALL FUNCTION 'WS_DOWNLOAD'
EXPORTING
filename = 'C:\ERRORS.TXT'
filetype = 'DAT'
TABLES
data_tab = it_err.
* Subroutine for bdc_dynpro.
FORM bdc_dynpro USING program dynpro.
CLEAR bdcdata.
bdcdata-program = program.
bdcdata-dynpro = dynpro.
bdcdata-dynbegin = 'X'.
APPEND bdcdata.
ENDFORM. "BDC_DYNPRO
* Subroutine for bdc_field.
FORM bdc_field USING fnam fval.
CLEAR bdcdata.
bdcdata-fnam = fnam.
bdcdata-fval = fval.
APPEND bdcdata.
ENDFORM. "BDC_FIELD
* Subroutine for bdc_transaction.
FORM bdc_transaction USING tcode.
DATA text(74).
DATA text1(34).
DATA text2(20).
text1 = 'Uploading Data for MATERIAL(MAKTX):' .
text2 = '---PLEASE WAIT.'.
CONCATENATE text1 itab-MAKTX text2 INTO text.
CALL FUNCTION 'SAPGUI_PROGRESS_INDICATOR'
EXPORTING
text = text
EXCEPTIONS
OTHERS = 1.
REFRESH messtab.
CALL TRANSACTION tcode USING bdcdata
MODE 'N'
* MODE 'A'
UPDATE 'S'
MESSAGES INTO messtab.
l_subrc = sy-subrc.
* Moving data to it_trec.
MOVE l_subrc TO it_trec-rtcode.
MOVE itab-line TO it_trec-rec.
MOVE itab-MAKTX TO it_trec-MAKTX.
MOVE itab-MATKL TO it_trec-MATKL.
APPEND it_trec.
* Looping in bdcmsgcoll structure.
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.
MOVE l_mstring TO it_trec-mess.
MODIFY it_trec INDEX sy-tabix.
ENDIF.
ENDLOOP.
FORMAT COLOR 4.
* Catching error records from it_trec & moving to it_err.
LOOP AT it_trec WHERE rtcode <> 0.
MOVE-CORRESPONDING it_trec TO it_err.
APPEND it_err.
ENDLOOP.
REFRESH it_trec.
REFRESH bdcdata.Nikhil.
Edited by: Nikhil Kanegaonkar on May 27, 2009 2:31 PM
‎2009 May 28 7:54 AM
Hi,
Check if this snippet is of some help to you.
Post BDC session programatically
SUBMIT rsbdcsub WITH mappe EQ v_session "v_session contains the session name you have created in your program
WITH von EQ sy-datum
WITH bis EQ sy-datum
AND RETURN.
Displaying session for errors
selection for qid to display session log
SELECT SINGLE qid
INTO v_qid FROM
apqi WHERE
datatyp = 'BDC'
AND groupid = v_session
AND progid = sy-repid
AND userid = sy-uname
AND credate = sy-datum.
IF v_qid IS NOT INITIAL.
submit the program for BDC session error log
SUBMIT rsbdc_protocol
WITH session EQ v_session
WITH user EQ sy-uname
WITH queue_id EQ v_qid
AND RETURN.
‎2009 Jun 08 8:46 AM
Hi Nitwick,
I am facing same problem in calling the error log from the sm35 as report.
As you said
SELECT SINGLE qid
INTO v_qid FROM
apqi WHERE
datatyp = 'BDC'
AND groupid = l_c_session
AND progid = sy-repid
AND userid = sy-uname
AND credate = sy-datum.
IF v_qid IS NOT INITIAL.
submit the program for BDC session error log
SUBMIT rsbdc_protocol
WITH session EQ l_c_session
WITH user EQ sy-uname
WITH queue_id EQ v_qid
AND RETURN.
ENDIF.
Here my dout is v_quid how you declare as internal table or
data: v_quid type apqui-quid..
let me know.
Regards
Yugandhar
‎2009 Jun 08 8:56 AM
Hi Nitwick,
I am facing same problem in calling the error log from the sm35 as report.
As you said
SELECT SINGLE qid
INTO v_qid FROM
apqi WHERE
datatyp = 'BDC'
AND groupid = l_c_session
AND progid = sy-repid
AND userid = sy-uname
AND credate = sy-datum.
IF v_qid IS NOT INITIAL.
submit the program for BDC session error log
SUBMIT rsbdc_protocol
WITH session EQ l_c_session
WITH user EQ sy-uname
WITH queue_id EQ v_qid
AND RETURN.
ENDIF.
Here my dout is v_quid how you declare as internal table or
data: v_quid type apqui-quid..
let me know.
Regards
Yugandhar
‎2009 May 28 11:36 AM
I have gone to Call transaction
Edited by: Ajay kumar on May 28, 2009 12:37 PM