‎2008 Mar 03 4:19 PM
Hi,
After running a BDC session, I want to get error log on the run. But right now I' am going to error log, queue dump and various places to get the report. Has SAP provided any tool or utility which will make the reporting of this task easy? If so, let me know.
Thanks,
Aravind
‎2008 Mar 04 4:00 AM
hi
try this code in the bdc program.
it displays the error log and success log.
&----
*& Form DISPLAY_SUCCESS_RECORDS
&----
text
----
FORM display_success_records.
WRITE:/ 'Success Records' COLOR 5.
LOOP AT t_smess.
WRITE:/3 t_smess-msg.
READ TABLE t_success INDEX sy-tabix.
WRITE:/2 t_success-pernr_001(038),
t_success-timr6_002(001),
t_success-choic_003(035),
t_success-subty_004(004),
t_success-begda_005(010),
t_success-endda_006(010),
t_success-usrid_007(030).
endloop.
WRITE:/1 sy-uline(150).
ENDFORM. " DISPLAY_SUCCESS_RECORDS
&----
*& Form DISPLAY_ERROR_RECORDS
&----
text
----
FORM display_error_records.
WRITE:/ 'Error Records' COLOR 7.
LOOP AT t_emess.
WRITE:/3 t_emess-msg.
READ TABLE t_error INDEX sy-tabix.
WRITE:/2 t_error-pernr_001(038),
t_error-timr6_002(001),
t_error-choic_003(035),
*
t_error-subty_004(004),
t_error-begda_005(010),
t_error-endda_006(010),
t_error-usrid_007(030).
ENDLOOP.
ENDFORM. " DISPLAY_ERROR_RECORDS
‎2008 Mar 06 10:56 PM
Hello Ramya,
How to get data in the internal tables?
Thanks,
Aravind
‎2008 Mar 04 4:19 AM
hi,
Check out this bdc prog.
data: err type standard table of bdcmsgcoll with header line.
the above declaration is made to get the error log:
Sample code:
report z_aru_bdc_new4
no standard page heading line-size 255.
include bdcrecx1.
*parameters: dataset(132) lower case.
DO NOT CHANGE - the generated data section - DO NOT CHANGE ***
*
If it is nessesary to change the data section use the rules:
1.) Each definition of a field exists of two lines
2.) The first line shows exactly the comment
'* data element: ' followed with the data element
which describes the field.
If you don't have a data element use the
comment without a data element name
3.) The second line shows the fieldname of the
structure, the fieldname must consist of
a fieldname and optional the character '_' and
three numbers and the field length in brackets
4.) Each field must be type C.
*
Generated data section with specific formatting - DO NOT CHANGE ***
parameters: p_file like rlgrap-filename obligatory.
data: err type standard table of bdcmsgcoll with header line.
data: mess(200) type c.
data: begin of it_err occurs 0,
msg(200) type c,
end of it_err.
data: begin of record occurs 0,
data element:
viewname_001(030),
data element: VIM_LTD_NO
ltd_dta_no_002(001),
data element: ZEMPID3
zempid3_003(004),
data element: ZENAME3
zename3_008(040),
data element: ZEDEPID
zedepid_009(004),
data element:
zsalkey_010(005),
data element:
salary_011(013),
data element: ZENAME3
ZENAME3_008(040),
data element: ZEDEPID
ZEDEPID_009(004),
data element:
ZSALKEY_010(005),
data element:
SALARY_011(013),
end of record.
End generated data section ***
start-of-selection.
at selection-screen on value-request for p_file.
call function 'WS_FILENAME_GET'
exporting
DEF_FILENAME = ' '
DEF_PATH = ' '
mask = '.,..'
mode = 'O' " O -- open, S -- Save.
title = 'OPEN'
importing
filename = p_file
RC =
exceptions
inv_winsys = 1
no_batch = 2
selection_cancel = 3
selection_error = 4
others = 5.
start-of-selection.
call function 'UPLOAD'
exporting
CODEPAGE = ' '
filename = p_file
filetype = 'DAT'
ITEM = ' '
FILEMASK_MASK = ' '
FILEMASK_TEXT = ' '
FILETYPE_NO_CHANGE = ' '
FILEMASK_ALL = ' '
FILETYPE_NO_SHOW = ' '
LINE_EXIT = ' '
USER_FORM = ' '
USER_PROG = ' '
SILENT = 'S'
IMPORTING
FILESIZE =
CANCEL =
ACT_FILENAME =
ACT_FILETYPE =
tables
data_tab = record
exceptions
conversion_error = 1
invalid_table_width = 2
invalid_type = 3
no_batch = 4
unknown_error = 5
gui_refuse_filetransfer = 6
others = 7
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
*perform open_dataset using dataset.
*perform open_group.
delete record index 1.
loop at record.
*read dataset dataset into record.
*if sy-subrc <> 0. exit. endif.
perform bdc_dynpro using 'SAPMSVMA' '0100'.
perform bdc_field using 'BDC_CURSOR'
'VIEWNAME'.
perform bdc_field using 'BDC_OKCODE'
'=UPD'.
perform bdc_field using 'VIEWNAME'
record-viewname_001.
perform bdc_field using 'VIMDYNFLDS-LTD_DTA_NO'
record-ltd_dta_no_002.
perform bdc_dynpro using 'SAPLZSHAP' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-ZEMPID3(01)'.
perform bdc_field using 'BDC_OKCODE'
'=NEWL'.
perform bdc_dynpro using 'SAPLZSHAP' '0002'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-SALARY'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_field using 'ZEMPTAB1-ZEMPID3'
record-zempid3_003.
perform bdc_field using 'ZEMPTAB1-ZENAME3'
record-zename3_008.
perform bdc_field using 'ZEMPTAB1-ZEDEPID'
record-zedepid_009.
perform bdc_field using 'ZEMPTAB1-ZSALKEY'
record-zsalkey_010.
perform bdc_field using 'ZEMPTAB1-SALARY'
record-salary_011.
perform bdc_dynpro using 'SAPLZSHAP' '0002'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-ZENAME3'.
perform bdc_field using 'BDC_OKCODE'
'=UEBE'.
perform bdc_field using 'ZEMPTAB1-ZENAME3'
record-zename3_008.
perform bdc_field using 'ZEMPTAB1-ZEDEPID'
record-zedepid_009.
perform bdc_field using 'ZEMPTAB1-ZSALKEY'
record-zsalkey_010.
perform bdc_field using 'ZEMPTAB1-SALARY'
record-salary_011.
perform bdc_dynpro using 'SAPLZSHAP' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-ZEMPID3(01)'.
perform bdc_field using 'BDC_OKCODE'
'=SAVE'.
perform bdc_dynpro using 'SAPLZSHAP' '0001'.
perform bdc_field using 'BDC_CURSOR'
'ZEMPTAB1-ZEMPID3(01)'.
perform bdc_field using 'BDC_OKCODE'
'=BACK'.
perform bdc_dynpro using 'SAPMSVMA' '0100'.
perform bdc_field using 'BDC_OKCODE'
'/EBACK'.
perform bdc_field using 'BDC_CURSOR'
'VIEWNAME'.
perform bdc_transaction using 'SM30'.
*enddo.
*perform close_group.
*perform close_dataset using dataset.
endloop.
loop at it_err.
write : / it_err-msg.
endloop.
form error.
call function 'FORMAT_MESSAGE'
exporting
id = sy-msgid
lang = '-D'
no = sy-msgno
v1 = sy-msgv1
v2 = sy-msgv2
v3 = sy-msgv3
v4 = sy-msgv4
importing
msg = mess
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.
endif.
it_err-msg = mess.
append it_err.
clear it_err.
endform.
Hope this helps u,
Regards,
Arunsri
‎2008 Mar 06 11:00 PM
When using 'call transaction', using bdcmscoll you can get the
related error messages. But if you are running bdc session,
how to do that, and if you need some data from queue, whether
the only possible
way is to go and look at error message and log each and every time.
Thanks,
Aravind
‎2009 Oct 27 3:01 AM