‎2009 Jun 11 4:05 PM
Hi this is saroj.
(1) i have issue bdc.i have done bdc by call transaction method.
suppose i have 100 records.90 are uploaded.10 not uploaded.
how to handle the error and how to upload the rest 10 records.
(2) suppose data is in unix file.how to upload the unix file in bdc.
please answer the questions.
regards
saroj kanta maharana
‎2009 Jun 11 4:08 PM
using BDC message you can handle..
try to use session the error records which are not uploaded will create session ..
next try to run the session with the 10 records which are not updated..
see the sample code..
CALL TRANSACTION 'ME22'
USING bdc_tab
MODE w_lmode
UPDATE 'S'
MESSAGES INTO message_tab. "all the error messages are stored in message_tab
* Error handling
READ TABLE message_tab WITH KEY msgtyp = 'E'
IF sy-subrc NE 0.
LOOP AT message_tab.
MOVE message_tab-msgnr TO message_no.
MOVE message_tab-msgv1 TO message_v1.
MOVE message_tab-msgv2 TO message_v2.
MOVE message_tab-msgv3 TO message_v3.
MOVE message_tab-msgv4 TO message_v4.
CALL FUNCTION 'BAPI_MESSAGE_GETDETAIL'
EXPORTING
id = message_tab-msgid
number = message_no
language = message_tab-msgspra
textformat = textformat
message_v1 = message_v1
message_v2 = message_v2
message_v3 = message_v3
message_v4 = message_v4
IMPORTING
message = err_msg_tab-message
return = return.
APPEND err_msg_tab.
ENDLOOP.
CONCATENATE 'GM' sy-datum sy-uzeit INTO group. "Group is the session name
MOVE 'ME22' TO tcode. "Pass your t-code
CALL FUNCTION 'BDC_OPEN_GROUP'
EXPORTING
client = sy-mandt
group = group
user = sy-uname
keep = keep
holddate = holddate.
CALL FUNCTION 'BDC_INSERT'
EXPORTING
tcode = tcode
TABLES
dynprotab = bdc_tab.
CALL FUNCTION 'BDC_CLOSE_GROUP'.
ENDIF.
Prabhudas
‎2009 Jun 11 4:27 PM
(2) suppose data is in unix file.how to upload the unix file in bdc.
to upload the Unix file..
you need to use FTP_connect ..FTP_command ...FTP_disconnect.. function modules
if it is application server..use open data set read data set and close dataset..
Prabhudas
‎2009 Jun 11 5:09 PM
Hi
To capture error in call transaction method - use
call transaction PA30 using t_bdcdata
mode n
update S
messages in t_bdcmsgcoll
where t_bdcmsgcoll is type bdcmsgcoll
use function module 'format_message' to get those error and success messages.
for those records where error is occured, you can display to the user and then after correfting those errors
run call transation for only those records.
and to read the file from unix server , use open dataset and read dataset.
then use this data accordingly in your recording
thanks. let me know if u have further queres..
‎2009 Aug 14 4:56 PM