2008 Feb 05 5:59 AM
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
2008 Feb 05 7:39 AM
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.
2008 Feb 05 7:44 AM
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.
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |