‎2008 Dec 01 5:25 AM
Hi All,
I have trouble using the FM GUI_UPLOAD. I am using this FM to upload text-delimited file data into an ITAB of same structure. The problem is that it is reading only the 1st record and returning sy-subrc = 8. The no of columns in file is 89. When I am reducing the no of columns of this file, then it is reading the data. There is not data format conversion problem, I have check the same. Does any one know why this is happening? Thanks in advance.
Regards,
Prashant.
‎2008 Dec 01 5:50 AM
data : begin of lt_d occurs 0,
data type string,
end of lt_d.
Use this for the upload function module
Gui_upload and u have the data in lt_d.
delete lt_d where data is initial.
loop at lt_d.
split : lt_d at separator into
wa_itab .....
append wa_itab to itab.
endloop.
use this ...
‎2008 Dec 01 5:28 AM
Dear Prashant,
I think you need to check your Function parameters.
Check for Tab settings also.
It will sure work.
All the best.
-Maharshi
‎2008 Dec 01 5:31 AM
Hi,
I don't see the problem there. Following are the parameters used by me in the FM:
EXPORTING
filename = l_file
filetype = 'ASC'
has_field_separator = 'X'
read_by_line = 'X'
TABLES
data_tab = it_conv_data.
FYI the FM is not working with or without the parameter read_by_line.
Reagards,
Prashant
‎2008 Dec 01 5:46 AM
Hi Prashant,,,,,
The Function Parameters are good, Just remove READ_BY_LINE Parameter,,,,,,,,
The Possible exception could be "BAD_DATA_FORMAT" as the function module Cannot Interpret Data in File
Please Check your file as there is no other reason for this exception,,,,,,,
Try uploading with another file,,,,,
Thanks
Saurabh
‎2008 Dec 01 5:50 AM
data : begin of lt_d occurs 0,
data type string,
end of lt_d.
Use this for the upload function module
Gui_upload and u have the data in lt_d.
delete lt_d where data is initial.
loop at lt_d.
split : lt_d at separator into
wa_itab .....
append wa_itab to itab.
endloop.
use this ...
‎2008 Dec 01 5:50 AM
Hi Saurabh,
As mentioned earlier it is not working with or without read_by_line. Any other ideas. I have tested the program with multiple text files but no luck.
Reagards,
Prashant.
‎2008 Dec 01 5:51 AM
hi prashant,
try this oops concept.
CALL METHOD cl_gui_frontend_services=>gui_upload
EXPORTING
filename = l_v_filepc
filetype = 'TXT'
has_field_separator = ' '
header_length = 0
read_by_line = 'X'
dat_mode = SPACE
codepage = SPACE
ignore_cerr = ABAP_TRUE
replacement = '#'
virus_scan_profile =
IMPORTING
filelength =
header =
CHANGING
data_tab = fp_it_pernr_infty "fp_it_pernr
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
not_supported_by_gui = 17
error_no_gui = 18
OTHERS = 19 .
IF sy-subrc <> 0.
...
ENDIF.
‎2008 Dec 01 5:53 AM
Hi Prashant,
Save your records in an excel file as 'TEXT DELIMITED' file type and pass this text file.
In the GUI_UPLOAD function module, try using these parameters only.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
FILENAME = 'c:\vendors.txt'
FILETYPE = 'DAT'
TABLES
DATA_TAB = VENDOR_TAB.
Hope this solves your problem.
Thanks & Regards.
Tarun Gambhir.
Edited by: Tarun Gambhir on Dec 1, 2008 11:28 AM
‎2008 Dec 01 9:31 AM