‎2005 Aug 18 4:26 PM
Hello
We were trying to upload the file from a specified location using the function module 'UBC_FILE_UPLOAD' and then transfer the contents from the internal table into a target file in a different location.
The TRANSFER statement does not actually transfer the contents of the internal table and instead just displays the target path.
Please refer to the following code:
DATA: S_FILE LIKE RLGRAP-FILENAME,
T_FILE like RLGRAP-FILENAME,
itab type UBC_S_DATA occurs 0 with header line.
S_FILE = 'C:\Documents and Settings\rashmi.hegde\Desktop\example.txt'.
T_FILE = 'C:\Documents and Settings\rashmi.hegde\My Documents'.
CALL FUNCTION 'UBC_FILE_UPLOAD'
EXPORTING
I_FILENAME = S_FILE
I_ORIGIN = 'P'
TABLES
ET_DATA = itab[]
EXCEPTIONS
ERROR = 1
OTHERS = 2
.
IF SY-SUBRC <> 0.
MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.
open dataset t_file in text mode ENCODING DEFAULT for output.
if sy-subrc = 0.
loop at itab.
TRANSFER itab TO t_file.
endloop.
endif.
close dataset t_file.
*********************************
Any input is greatly appreciated
thanks
‎2005 Aug 18 4:32 PM
Hi Rashmi,
I would like to suggest two things here.
Instead of 'UBC_FILE_UPLOAD' please use GUI_DOWNLOAD.
You cannot write a file to your computer using the OPEN DATASET command. This is for transfering file to the application server. Instead use GUI_DOWNLOAD.
Thanks
Vinod
‎2005 Aug 18 4:37 PM
Hi!
Transfer likes to handle a simple character field.
Do something like
data line type char100.
concatenate itab-field1 itab-field2 ... into line.Regards,
Christian
‎2005 Aug 18 4:45 PM
Hi Rashmi,
For uploading a file from your desktop or presentation server, you have to use GUI_UPLOAD and for downloading to the the same, use GUI_DOWNLOAD.
OPEN DATASET, READ TRANSFER, CLOSE DATASET are usually used for file on the application server(typically unix).
Srinivas
‎2005 Aug 18 4:51 PM
Sorry, hadn't checked the path definitions - of course GUI_UPLOAD / GUI_DOWNLOAD is to be preferred
‎2005 Aug 18 4:50 PM
please search forum with gui_download and gui_upload you will find many links as well as examples.
or else use where used list of se37
regards