‎2008 Jun 18 8:12 PM
Hello all,
I run my program & send itab to pc using gui_download.
In that FM I have used File Name & Tables 2 parameters only.
Now I am trying to upload that file in my itab using gui_upload.
But it is giving error ' can not interpret data in file'.
can you tell me plz why?
or I will appreciate if u provide me sample code.
Thanks.
‎2008 Jun 18 8:14 PM
Hi,
Check out the below sample code ... Hope it helps ..
http://www.sapdev.co.uk/file/file_uptabpc.htm
Regards,
Santosh
‎2008 Jun 18 8:26 PM
Cheers,
PARAMETERS: p_file LIKE rlgrap-filename.
START-OF-SELECTION.
v_filename_string = p_file.
CALL FUNCTION 'GUI_UPLOAD'
EXPORTING
filename = v_filename_string
filetype = 'ASC'
has_field_separator = 'X'
HEADER_LENGTH = 0
READ_BY_LINE = 'X'
dat_mode = ''
IMPORTING
FILELENGTH =
HEADER =
TABLES
data_tab = i_text_data
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.Reward if helpfull.
thanks
deepak
‎2008 Jun 18 8:47 PM
Hi
You have to pass two more as mandatory to gui_download.
One is filetype = 'ASC' this defines the file content.
and other is has_field_separator = 'X' by default file has TAB delimited take care that while you create your flat file use TAB while entering data into the file.
Regards
‎2008 Jun 18 8:51 PM
The itab to fill with the FM gui_upload must be like this:
BEGIN OF itab OCCURS 0,
field1(10) TYPE C,
field2(5) TYPE C,
...
END OF itab.All this fields type C.
‎2008 Jun 19 3:26 AM
Hi Rani,
Try to pass the file parameter to a string. If you will use GUI_UPLOAD or GUI_DOWNLOAD, the file parameter should ALWAYS pass to a string if the file parameter is type RLGRAP-FILENAME. Try to change the GUI_UPLOAD/ GUI_DOWNLOAD, to WS_UPLOAD/ WS_DOWNLOAD. Here, you can directly pass the file parameter to the FM. Hope this will help you.
parameter: r_file type rlgrap-filename,
r_string type string.
r_file = r_string.
call function 'GUI_UPLOAD'.
.................
.................
Regards,
Mark Oro