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

CSV FILE UPLOAD

Former Member
0 Likes
532

DEAR ALL,

I am facing one problem while uploading csv file.

I have 2 csv files.

i use the function module

CALL FUNCTION 'KCD_CSV_FILE_TO_INTERN_CONVERT'

EXPORTING

i_filename = L_FILENAME "'C:\Temp\Book1.csv'

i_separator = ','

TABLES

e_intern = l_intern

EXCEPTIONS

upload_csv = 1

upload_filetype = 2.

LOOP AT l_intern.

MOVE : l_intern-col TO v_index.

ASSIGN COMPONENT v_index OF STRUCTURE W_ERQ TO <fs>.

MOVE : l_intern-value TO <fs>.

AT END OF row.

APPEND W_ERQ TO GT_ERQ.

CLEAR W_ERQ.

ENDAT.

ENDLOOP.

It is working working for one file. while uploading another file it is showing simble (") " with mail ids"

In the sence i have my csv files one column mail id of approver. But it is fetching from csv file mail-ids but starting mail with " and end of mail it showing the simble ".

HOw should i over come this problem

Thanks

margani

3 REPLIES 3
Read only

JoffyJohn
Active Contributor
0 Likes
460

this is how we did

DATA: BEGIN OF l_intern OCCURS 0,

text(300) TYPE c.

DATA: END OF l_intern.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = gv_filenamep

TABLES

data_tab = l_intern.

LOOP AT l_intern.

CLEAR: split_record, record.

SPLIT l_intern-text AT ','

INTO split_record-pernr

split_record-workdate

split_record-skostl

split_record-catshours

split_record-lstar

split_record-rproj

split_record-raufnr

split_record-belnr.

MOVE-CORRESPONDING split_record TO record.

APPEND record.

ENDLOOP.

Read only

Former Member
0 Likes
460

Dear joffy john ,

If i am using this one ; it is going to dump runtime error.

Thanks

margani

Read only

Former Member
0 Likes
460

If your CSV has tabulator as separetor, this code will fill your internal table without any other code.

DATA: l_filename TYPE string.

l_filename = p_file.

REFRESH wt_input.

CALL FUNCTION 'GUI_UPLOAD'

EXPORTING

filename = l_filename

filetype = 'ASC'

has_field_separator = 'X'

dat_mode = 'X'

TABLES

data_tab = wt_input[]

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 <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.