‎2008 Jul 10 1:24 PM
Good Day Everybody!!
I am having one intresting issue in BDC.
I am having a BDC which does REAd PP MASTER DATA
in CO02 transaction.
While reading master data if any errors are generated these are
logged in error log which is avalable from
MENU->
GO TO->
LOGS
->Read PP Master Data
However these are not captured in BDC error table.
How do i access these errors from Error LOG.
Any Exit or Enhance ment spot available to capture these errors.?
Any suggestions?
‎2008 Jul 10 1:28 PM
Hi,
The BDC will not handle errors unless we explicitly use
CALL TRANSACTION 'tcode' MESSAGES BDCMSGCOLL.
we need to decalre an internal table of this BDCMSGCOLL type but here it will not state the error clearly only message numbers can be seen.
In BDC if there are any errors then send them to Session method.
We have to combine both Session and BDC to handle the errors.
Error log can be seen in Session method SM35 and check in erro log tab for that tcode.
Reward if helpful.
Best Wishes,
Chandralekha
‎2008 Jul 10 1:31 PM
Chandralekha,
I am using internal table of type BDCMESSAGECOLL
to cpature errors.
but problem is errors are getting generated in background of SAP and dyanmically updating Error Log of CO02 transaction.
so these are not at all captured by BDC since these errors
does not flash on screen.
‎2008 Jul 10 7:47 PM
Hi
When you did your recording, ar eyou able to generate these errors? If you can , then those can be captured in BDC MSGCOLL. If not they might be update errors. In such cases the BDC call transaction will anyway give u a sy-subrc of 1001.
then the best option is to move it to SM35 using session method and process it.
Can you give a gyst of what are the errors that go to the SAP log?
Thanks
Shobana
‎2008 Jul 11 3:37 AM
Hi,
Please check following code that I have used.
Internal table structure:
data:begin of itab occurs 0,
werks like aufk-werks,
auart like aufk-AUART,
aufnr like aufk-aufnr,
PLNBEZ LIKE AFKO-PLNBEZ,
GSTRP like afko-GSTRP, "Order start date
TDATE TYPE AFKO-GSTRP,
TEXT01(12) TYPE C,
TEXT02(12) TYPE C,
end of itab.
BDC Program:
loop at itab.
clear:l_strerr,bdcdata.
refresh bdcdata.
if sy-subrc = 0.
perform bdc_dynpro using 'SAPLCOKO1' '0110'.
perform bdc_field using 'BDC_CURSOR'
'CAUFVD-AUFNR'.
perform bdc_field using 'BDC_OKCODE'
'/00'.
perform bdc_field using 'CAUFVD-AUFNR'
itab-aufnr.
perform bdc_field using 'R62CLORD-FLG_OVIEW'
'X'.
perform bdc_dynpro using 'SAPLCOKO1' '0115'.
perform bdc_field using 'BDC_OKCODE'
'=STAK'.
perform bdc_dynpro using 'SAPLCOKO1' '0131'.
perform bdc_field using 'BDC_OKCODE'
'=ENT1'.
perform bdc_field using 'BDC_CURSOR' 'RC62F-AUFLD'.
perform bdc_field using 'RC62F-NEW_BOM' 'X'.
perform bdc_field using 'RC62F-AUFLD' ITAB-TEXT02.
perform bdc_dynpro using 'SAPLCOKO1' '0115'.
perform bdc_field using 'BDC_OKCODE'
'=BU'.
CALL TRANSACTION 'CO02' USING BDCDATA
MODE P_MODE
UPDATE 'S'
MESSAGES INTO IT_MSG.
if sy-subrc <> 0.
l_strerr = 'error'.
endif.
else.
l_strerr = ' is not exist in table'.
endif.
IF not l_strerr is initial .
move-corresponding itab to itab_err.
itab_err-strerr = l_strerr.
append itab_err.
delete itab.
endif.
*----
*FORM BDC_DYNPRO
*----
FORM BDC_DYNPRO USING PROGRAM DYNPRO.
CLEAR BDCDATA.
BDCDATA-PROGRAM = PROGRAM.
BDCDATA-DYNPRO = DYNPRO.
BDCDATA-DYNBEGIN = 'X'.
APPEND BDCDATA.
ENDFORM.
*----
*FORM BDC_FIELD
*----
FORM BDC_FIELD USING FNAM FVAL.
IF FVAL <> ''.
CLEAR BDCDATA.
BDCDATA-FNAM = FNAM.
BDCDATA-FVAL = FVAL.
APPEND BDCDATA.
ENDIF.
ENDFORM.