Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Doubt on BDC

Former Member
0 Likes
510

Hi Experts,

I uploading Data by using BDC for this i use flat file is .CSV file.For uploading that .csv file i am using the function module 'WS_FILENAME_GET' . For this i used the function module for uploading 'WS_FILENAME_GET" .. Then its working fyn. But i am using ECC6.0 version in that for uploading file the Function module is GUI_UPLOAD.

When i use this function module it comes the runtime error. Please suggest me the function module for uplaoding .CSV files in ECC6.0

Thanks in ADVANCE

Thanks and Regards

Siri

Hi Experts,

I uploading Data by using BDC for this i use flat file is .CSV file.For uploading that .csv file i am using the function module 'WS_FILENAME_GET' . For this i used the function module for uploading 'WS_FILENAME_GET" .. Then its working fyn. But i am using ECC6.0 version in that for uploading file the Function module is GUI_UPLOAD.

When i use this function module it comes the runtime error. Please suggest me the function module for uplaoding .CSV files in ECC6.0

Thanks in ADVANCE

Thanks and Regards

Siri

2 REPLIES 2
Read only

Former Member
0 Likes
484

Hi Abi,

Make sure you set FILETYPE to ASC. However, you have to process the uploaded table yourself to split the lines at "," into the relevant columns.

Regards,

John.

Read only

Former Member
0 Likes
484

Check the code below:

&----


*& Form upload_csv_file

&----


To upload CSV file into internal table *

-


FORM upload_csv_file .

CLEAR gv_file.

gv_file = pa_file.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = gv_file

filetype = 'ASC'

has_field_separator = 'X'

TABLES

data_tab = gt_dummy

EXCEPTIONS

file_open_error = 1

file_read_error = 2

no_batch = 3

gui_refuse_filetransfer = 4

invalid_type = 5

no_authority = 6

unknown_error = 7

bad_data_format = 8

header_not_allowed = 9

separator_not_allowed = 10

header_too_long = 11

unknown_dp_error = 12

access_denied = 13

dp_out_of_memory = 14

disk_full = 15

dp_timeout = 16

OTHERS = 17.

IF sy-subrc NE gc_zero_num.

MESSAGE i006.

LEAVE LIST-PROCESSING.

ENDIF.

Check if the input file is blank

IF gt_dummy[] IS INITIAL.

MESSAGE i007.

LEAVE LIST-PROCESSING.

ENDIF.

To remove quotes in the table

LOOP AT gt_dummy INTO gs_dummy. "#EC CI_LOOP_INTO_WA

gv_tabix = sy-tabix.

DO.

IF gs_dummy CA '"'.

REPLACE '"' WITH space INTO gs_dummy.

ELSE.

WRITE gs_dummy TO gs_dummy NO-GAP.

CONDENSE gs_dummy.

MODIFY gt_dummy INDEX gv_tabix FROM gs_dummy.

EXIT.

ENDIF.

ENDDO.

ENDLOOP.

ENDFORM. " upload_csv_file

Reward points if useful.