‎2008 Nov 26 5:29 AM
HI Experts,
I am uploading data from a .csv file and the internal table i am using for storing the data is as below:
TYPES : BEGIN OF t_file ,
data(360),
END OF t_file.
DATA : i_file TYPE TABLE OF t_file,
wa_file TYPE t_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = l_path
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
DAT_MODE = ' '
IMPORTING
FILELENGTH = file_lth
HEADER =
TABLES
data_tab = i_file
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
And the problem is , for every record only the first 132 characters are getting uploaded and rest of the record is getting truncated.
Regards,
Praveen.
‎2008 Nov 26 5:33 AM
‎2008 Nov 26 5:33 AM
‎2008 Nov 26 5:37 AM
Hello,
Try in this way it is working fine.
types: begin of y_t_in_out,
record type char8000 ,
end of y_t_in_out.
data: y_i_tab_in type table of y_t_in_out,
data y_pv_fname type string.
constants: y_lc_asc type char10 value 'ASC'.
call function 'GUI_UPLOAD'
exporting
filename = y_pv_fname
filetype = y_lc_asc
tables
data_tab = y_i_tab_in
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.
‎2008 Nov 26 5:44 AM
Hi santosh,
I tried as u said...but the same problem is occuring...its is accepting only 132 chars.
‎2008 Nov 26 5:43 AM
Hi,
Then try this one out: [use cl_gui_frontend_services instead of GUI_UPLOAD]
DATA:
lv_title TYPE string,
lv_filter TYPE string,
lv_ext TYPE string,
lv_rc TYPE i,
li_selfiles TYPE STANDARD TABLE OF file_table,
lv_action TYPE i.
lv_title = 'Open File'.
lv_filter = 'Comma-Separated (CSV) file (.csv)|.csv|'. " HERE 'Comma-Separated (CSV) file'
" part is for comment [understanding purpose] and '(.csv)|.csv|' must be passed.
lv_ext = 'csv'.
call method cl_gui_frontend_services=>file_open_dialog
EXPORTING
WINDOW_TITLE = 'TEST'
DEFAULT_EXTENSION = lv_ext
DEFAULT_FILENAME =
FILE_FILTER = lv_filter
"This parameter could be used to capture any particular extention [eg, TXT or CSV or anything]
WITH_ENCODING =
INITIAL_DIRECTORY =
MULTISELECTION =
changing
file_table = li_selfiles
rc = lv_rc
USER_ACTION = lv_action
FILE_ENCODING =
EXCEPTIONS
FILE_OPEN_DIALOG_FAILED = 1
CNTL_ERROR = 2
ERROR_NO_GUI = 3
NOT_SUPPORTED_BY_GUI = 4
others = 5
.
if sy-subrc <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
endif.
Hope this helps.
‎2008 Nov 26 6:10 AM
Hi praveen,
Have you tried the code that i have posted? still it is not coming?
‎2008 Nov 26 6:14 AM
Hi,
I tried to implement it, but where are v going to pass the file path like we do it in GUI_UPLOAD for the file to be uploaded .
‎2008 Nov 26 7:19 AM
THanks i found the ans myself.Its nothing but during debugging the field shows only 132 chars but internally the entire content will be there.
‎2008 Nov 26 7:19 AM