cancel
Showing results for 
Search instead for 
Did you mean: 

File download or open functionality on Button click

Former Member
0 Kudos

I need to open the file from the directory mounted on the server, ot download it to my local PC on click of a button. There is a control LinkToURL in ABAP Wd which does the same functionality. But I need this functionality on button clicl event. Is it possible to trigger the same event (which is triggered on click of LinkToURL control ) on button click event?

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi,

I dont want to use the fileDownlaod control. I just want to use the functionlaity of FileDownload control without using the control. Is there any way to trigger the same event (as triggered by FileDownload control on click of it) on click of a button?

Thanks and regards,

Anand

thomas_szcs
Active Contributor
0 Kudos

Hi Anand,

yes, that's possible. Just use CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE.

Best regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

Will you please tell me how to use CL_WD_RUNTIME_SERVICES .

If possible give me a sample code of how to use that class

Best Wishes

Idhaya R

thomas_szcs
Active Contributor
0 Kudos

Hello Idhaya,

just copy from the button view of WDR_TEST_EVENTS.

Best regards,

Thomas

Former Member
0 Kudos

Hi Thomas,

Is this for Webdynpro Java. Am not able to do it

Please help.

Best Wishes

Idhaya R

thomas_szcs
Active Contributor
0 Kudos

Hello Idhaya,

it's for Web Dynpro ABAP. Got SAP access today, so here's the code snippet:


  cl_wd_runtime_services=>attach_file_to_response(
    i_filename  = your_filename
    i_content   = your_content_as_xstring
    i_mime_type = 'text/plain' "or what you need
    i_in_new_window = abap_false 
    i_inplace       = abap_false ).

Feel free to experiment with parameters i_in_new_window and i_inplace to adopt them to your needs.

Best regards,

Thomas

Former Member
0 Kudos

Hi

Insted of link to URL , please use FileUpload / FileDownload UI elements.

Thanks

Vishal Kapoor