cancel
Showing results for 
Search instead for 
Did you mean: 

Downloading to a file

Former Member
0 Kudos

Hi Experts,

I have to write internal table data to a ".xml " file.

in the internal table data is in the XML format. Just I need to download to a file with extension XML to a local directory.

How to do this.

Regards,

Vishal.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hello,

You can use the method attach_file_to_response from class cl_wd_runtime_services.

See the example in the web dynpro component WDR_TEST_EVENTS view BUTTON.

Regards.

Former Member
0 Kudos

Thanks David.

But here I did not find any option to specify directory path to store my file. I want to store the the file at a local directory eg: "C:/TEMP/"

How can I pass internal table data( type string) to this.

How can I specify File extension ( .XML in my case)

regards,

Vishal.

Former Member
0 Kudos

Hello Vishal,

Like any browser download, when you use this method will be showed to the user a popup screen where he can define where the file will be saved.

Regards.

Former Member
0 Kudos

Hi David,

In my case ....user is not supposed to enter the file name. I have to generate a file with a fix naming conventiona nd save it to a fix local path. and than from there using WebX it would be fetched.

I should not give any option to the user. and not supposed to display any dialog box.

Do u have any sample code for this.

I am using below code :

data:

conv_out type ref to cl_abap_conv_out_ce,

content type xstring.

conv_out = cl_abap_conv_out_ce=>create( encoding = 'UTF-8' ).

  • attach the first file

conv_out->convert( exporting data = 'Der Inhalt einer Textdatei' importing buffer = content ).

cl_wd_runtime_services=>attach_file_to_response(

i_filename = 'file1.txt'

i_content = content

i_mime_type = 'text/plain' ).

PLz reply.

Edited by: VISHAL GUPTA on May 28, 2008 9:46 AM