cancel
Showing results for 
Search instead for 
Did you mean: 

Download a PDF file in Webdynpro to a default location in the system

Former Member
0 Kudos

Hi Friends,

I Have a XString PDF Content which should be downloaded as a PDF file in webdynpro to a default location, which can be a desktop/downloads folder. We have function modules in R3 to download directly to a specified location but how to achieve this in webdynpro, i tried all the standard R3 function module which gives dumps, so please help me in downloading the file directly to a specified location from webdynpro application.

Thank you in advance...

Arjun.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

hello,

Check this link for an example to download a file from WebDynpro

http://an-sap-consultant.blogspot.com/2012/03/web-dynpro-abap-download-file.html

best regards,

swanand

Former Member
0 Kudos

Neither of the proposed solutions will automatically download the file and store it on the PC, meaning the browser will prompt the user for the action.

Some years back I solved a similar requirement by calling webgui from WDA. With webgui you can use the methods of ABAP class CL_GUI_FRONTEND_SERVICES.

Former Member
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi Samuli Kaski,

CL_GUI_FRONTEND_SERVICES class have the methods, which will download a file to the specified default location by clicking an button. But when we use all these R3 related classes and function modules it gives dump like, NOT_SUPPORTED_BY_GUI  exception, so is their any option in webdynpro so that we can directly store a file to a specified location.

Regards,

Manikandan

Former Member
0 Kudos

You didn't read or understand what I wrote, you have to use webgui which is SAP GUI for HTML (yes, the Internal ITS) for the class methods to work.

No, you can't do that in WDA as far as I am aware unless users default the action to save for the file type in question.

Former Member
0 Kudos

Assuming you are on NW701 or newer, you could look into making a ACF implementation for WDA. Assuming you setup a whitelist, you should be able to automatically (and silently) download files to the PC. See the attached link for details.

http://scn.sap.com/docs/DOC-2270

former_member210730
Participant
0 Kudos

Hi,

Please try this bleow code and see it works for your

place a LinkToAction UI Element in the View and in Event Handler code as follows

LV_FILENAME = 'RebateRequest.pdf'.

LV_CTYPE = 'pdf'.

CL_WD_RUNTIME_SERVICES=>ATTACH_FILE_TO_RESPONSE(

          EXPORTING I_FILENAME = LV_FILENAME

                    I_CONTENT  = LV_CONTENT

                    I_MIME_TYPE = LV_CTYPE

                    I_IN_NEW_WINDOW = ABAP_TRUE ).

where LV_CONTENT is XSTRING, convert your internal table to XSTRING.

Also kindly share the details of the Dump for further understanding

Regards

Vinay

Former Member
0 Kudos

Hi Vinay,

This code is downloading the pdf, but what happens is it opens a pop up and giving a option of save, open, cancel, i dont want this to happen and we cant pass the default location with the above logic, so is their any options like R3 gui download fn module where we can specify the default path to download, so in webdynpro also by clicking the download button it gets downloaded to the default location.

matt
Active Contributor
0 Kudos

I'm fairly surely that you cannot do this for security reasons. Think about it: do you want to go to a website and then have it decide where it downloads a file to your PC?