‎2007 Jan 12 4:13 PM
how to get the list of error records from batch input method.
‎2007 Jan 12 4:16 PM
u can record them using bdcmsgcoll and also in t100 table.
&----
*& Form prepare_bdc_tab
&----
Prepare BDC Table for updating Copack Purchase Prices
----
FORM prepare_bdc_tab .
REFRESH gv_bdc_tab.
*MEK1 intial screen
PERFORM bdc_dynpro USING 'SAPMV13A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RV13A-KSCHL'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'RV13A-KSCHL' 'PB00'.
PERFORM bdc_dynpro USING 'SAPLV14A' '0100'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RV130-SELKZ(03)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=WEIT'.
PERFORM bdc_field USING 'RV130-SELKZ(01)' ''.
PERFORM bdc_field USING 'RV130-SELKZ(03)' 'X'.
PERFORM bdc_dynpro USING 'SAPMV13A' '1018'.
PERFORM bdc_field USING 'BDC_CURSOR' 'RV13A-DATBI(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '/00'.
PERFORM bdc_field USING 'KOMG-LIFNR' gs_data-lifnr.
PERFORM bdc_field USING 'KOMG-MATNR' gs_data-matnr.
PERFORM bdc_field USING 'KOMG-EKORG' gs_data-ekorg.
PERFORM bdc_field USING 'KOMG-ESOKZ(01)' '0'.
PERFORM bdc_field USING 'KONP-KBETR(01)' gs_data-kbetr.
PERFORM bdc_field USING 'KONP-KONWA(01)' 'USD'.
PERFORM bdc_field USING 'KONP-KPEIN(01)' gs_data-peinh.
PERFORM bdc_field USING 'RV13A-DATAB(01)' gs_data-datab.
PERFORM bdc_field USING 'RV13A-DATBI(01)' gs_data-datbi.
PERFORM bdc_dynpro USING 'SAPMV13A' '1018'.
PERFORM bdc_field USING 'BDC_CURSOR' 'KOMG-ESOKZ(01)'.
PERFORM bdc_field USING 'BDC_OKCODE' '=SICH'.
ENDFORM. " prepare_bdc_tab
----
Start new screen *
----
FORM bdc_dynpro USING program dynpro.
CLEAR: gs_bdc_tab.
gs_bdc_tab-program = program.
gs_bdc_tab-dynpro = dynpro.
gs_bdc_tab-dynbegin = gc_x.
APPEND gs_bdc_tab TO gv_bdc_tab.
ENDFORM. "bdc_dynpro
*----
Insert field
*----
FORM bdc_field USING fnam fval.
CLEAR: gs_bdc_tab.
gs_bdc_tab-fnam = fnam.
gs_bdc_tab-fval = fval.
APPEND gs_bdc_tab TO gv_bdc_tab.
ENDFORM. "bdc_field
&----
*& Form call_transaction_mek1
&----
Call Transaction for updating CoPack Price entries
----
FORM call_transaction_mek1 .
*Local Data Declaration
CONSTANTS:lc_e TYPE c VALUE 'E',
lc_mek1(4) TYPE c VALUE 'MEK1',
lc_mode(1) TYPE c VALUE 'N',
lc_update(1) TYPE c VALUE 'U'.
REFRESH: gv_bdc_msg.
*Call MEK1 Transaction
CALL TRANSACTION lc_mek1
USING gv_bdc_tab
MODE lc_mode
UPDATE lc_update
MESSAGES INTO gv_bdc_msg.
IF sy-subrc NE 0.
IF gv_bdc_open_flag IS INITIAL.
PERFORM bdc_open_group.
gv_bdc_open_flag = gc_x.
ENDIF.
PERFORM bdc_insert_group.
DELETE gv_bdc_msg WHERE msgtyp NE lc_e.
REFRESH:gv_bdc_msg,
gv_bdc_tab.
ENDIF.
CLEAR:gs_data.
ENDFORM. " call_transaction_mek1
&----
*& Form bdc_open_group
&----
Subroutine for Open BDC Group
----
FORM bdc_open_group .
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = p_esnm
user = sy-uname
EXCEPTIONS
client_invalid = 1
destination_invalid = 2
group_invalid = 3
group_is_locked = 4
holddate_invalid = 5
internal_error = 6
queue_error = 7
running = 8
system_lock_error = 9
user_invalid = 10
OTHERS = 11.
IF sy-subrc <> 0.
WRITE 😕 text-040. "Error in BDC_OPEN_GROUP
EXIT.
ENDIF.
ENDFORM. " bdc_open_group
&----
*& Form BDC_INSERT_GROUP
&----
Subroutine for calling BDC_INSERT for inserting BDC Table
----
FORM bdc_insert_group .
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = 'MEK1'
TABLES
dynprotab = gv_bdc_tab
EXCEPTIONS
internal_error = 1
not_open = 2
queue_error = 3
tcode_invalid = 4
printing_invalid = 5
posting_invalid = 6
OTHERS = 7.
IF sy-subrc <> 0.
WRITE 😕 text-041. "Error in BDC_INSERT
EXIT.
ENDIF.
ENDFORM. " BDC_INSERT_GROUP
&----
*& Form BDC_CLOSE_GROUP
&----
Subroutine for Closeing of BDC group
----
FORM bdc_close_group .
CALL FUNCTION 'BDC_CLOSE_GROUP'
EXCEPTIONS
not_open = 1
queue_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
WRITE 😕 text-042. "Error in BDC_CLOSE_GROUP.
EXIT.
ENDIF.
ENDFORM. " BDC_CLOSE_GROUP
if u can see gv_bdc_msg is holding the messages
hope this helps
dont go through the code as it is ...it is only part of it
Message was edited by:
Durgaprasad Kare
‎2007 Jan 12 4:18 PM
Hi,
You can see errors list and details in log overview in transaction code SM35.
Regards,
Ferry Lianto
Please reward points if helpful.
‎2007 Jan 12 4:31 PM
Durgaprasad Kare & Ferry Lianto Thanks for your replies
Using bdcmsgcoll we can record the error reords for call
transaction method only not for batch input method, and
in sm35 we can see the log wheather the session is completed
sucessfully or not but i could not find the error records in it.
i need the error record values that occured in batch input method, which
table they are stored
‎2007 Jan 12 4:55 PM
hi,
the code provided can solve ur problem.
if u can go through the code
first the call transaction runs then if it fails the gv_bdc_msg tab will hold all the messaages and after that a session is called so that we can name that error session and then the table id read deleting the msgs not equal to error so tht all the msgs are now in gv_bdc_msg.
hope u understand this.