Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

File Manipulation

Former Member
0 Likes
728

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

5 REPLIES 5
Read only

Vinod_Chandran
Active Contributor
0 Likes
670

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

Read only

christian_wohlfahrt
Active Contributor
0 Likes
670

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

Read only

Former Member
0 Likes
670

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

Read only

0 Likes
670

Sorry, hadn't checked the path definitions - of course GUI_UPLOAD / GUI_DOWNLOAD is to be preferred

Read only

Former Member
0 Likes
670

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