cancel
Showing results for 
Search instead for 
Did you mean: 

How to download a file from a server path?

Former Member
0 Kudos

Is it possible to attach files on the server to a web dynpro response with cl_wd_runtime_services=>attach_file_to_response? All the examples I have seen assume you have the file content as an XSTRING. But how can one just send a file from a known path?

Is it really necessary to first load the file (e.g. a 50Mb TIFF) as an XSTRING before downloading it? If so, how is this done?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Marc,

Check this..It might solve

http://wiki.sdn.sap.com/wiki/display/WDABAP/UploadandDownloadfilesinWebdynproABAP

Cheers,

Kris.

Edited by: kissnas on Mar 3, 2011 2:34 PM

Former Member
0 Kudos

This solution also assumes I have the contents of my .TIFF or .ZIP file as a raw string which I don't. Is there no way to just provide a path to the download function or to convert a path to an XSTRING?

Former Member
0 Kudos

Hi Marc,

Try using this FM to convert String to Xstring.

SCMS_STRING_TO_XSTRING

HR_KR_STRING_TO_XSTRING

and also check this...

Might Helps you.

Cheers,

Kris.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

If you have a file path local to the application server you can read the content with the OPEN DATASET/READ DATA SET command. You will then have the content as an XSTRING in memory. Its really not that difficult.

Answers (1)

Answers (1)

former_member193202
Participant
0 Kudos

you can use the FileUpload UI to get the file-content in xstring format, and with this UI you can select the file via UserInteraction

Former Member
0 Kudos

The FileUpload control is for allowing users to upload data. I want them to download a file by clicking on a button. I can easily offer them a text file download if I generate the XSTRING but I don't know how to offer them a .ZIP or .TIFF download from a local (to the server) file path.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

> local (to the server) file path.

If it is local to the server you would first read the content into ABAP memory via the DATASET commands. You can then pass this content back via the cl_wd_runtime_services=>attach_file_to_response.