‎2009 Jun 22 9:31 AM
Hi experts,
I am facing an issue here. I tried to upload a .csv format file using FM - gui_load, in the table LT_RAW all the information is all in one column and rest of the columns are empty.
How can i get the information to its respective fields?
below are my codes:
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = pv_file
READ_BY_LINE = 'X'
HAS_FIELD_SEPARATOR = 'X'
codepage = '4110'
IMPORTING
filelength = lv_filelength
TABLES
data_tab = lt_raw
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.
I can only upload using .CSV format.
‎2009 Jun 22 9:44 AM
‎2009 Jun 22 10:03 AM
‎2009 Jun 22 10:06 AM
Hello,
Please remove the param. READ_BY_LINE & execute the FM again.
Does this problem occur again? Do revert back.
BR,
Suhas
‎2009 Jun 22 10:14 AM
Hi Suhas,
The problem still persist.
Any more ideas?
Thanks,
Lawrence
‎2009 Jun 22 10:22 AM
Hello Lee,
Can you please try to remove that HAS_FIELD_SEPARATOR because it identifies only TABs as FIELD_SEPARATOR?
Can you please share how you have defined your table?
I donot have any CSV files to test this :-((
BR,
Suhas
‎2009 Jun 22 10:30 AM
Hi Suhas,
below is the new code that i used. now the data is not filled in only one column,
Instead it will fill up the max length of the field and continue the data in other field and fill up its max length of the field.
" my declaration of lt_raw and ls_raw
lt_raw TYPE TABLE OF ZCTD_MIGCUSTOMER,
ls_raw like line of lt_raw,
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = pv_file
codepage = '4110'
IMPORTING
filelength = lv_filelength
TABLES
data_tab = lt_raw
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.
‎2009 Jun 22 10:34 AM
Hello,
What do you mean by:
Instead it will fill up the max length of the field and continue the data in other field and fill up its max length of the field
Please elaborate.
BR,
Suhas
‎2009 Jun 22 11:00 AM
Hi Suhas,
I think i solved my problem already. I saved it as .txt and it works. Previously, i saved it as .txt format but it does not work when uploading.
Now it works.
Thanks for your help
‎2009 Jun 22 10:07 AM
Hi Lawrence,
Please check the parameters and their types which you are passing to the Function module.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'C:\test.csv'
FILETYPE = 'ASC'
HAS_FIELD_SEPARATOR = '#'
TABLES
DATA_TAB = itab
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.Regards,
Amit.
‎2009 Jun 22 10:16 AM
Hi Amit,
I tried the parameters that you highlighted. But the problem still persist.
Any more ideas? Is it something got to do with my lt_raw table?
Thanks,
Lawrence
‎2009 Jun 22 10:24 AM
‎2009 Jun 22 10:33 AM
Hi SHASHANK,
no. I am using XP.
here is my patch level.
SAP_AP 700 0011 SAPKNA7011 SAP Application Platform