cancel
Showing results for 
Search instead for 
Did you mean: 

Upload PDF file to Webdynpro

Former Member
0 Kudos

Hi Experts,

I have read lots of posts, but any post could help me. Perhaps this post may help more people.

I have to upload a PDF file to show its contents either implace or in a new window. The FileUpload UI Elements is useless because it needs the interaction of the user. Can I write some code to decide the path of the FileUpload UI Element at runtime without the interaction of the user?

Thanks,

David.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Thank you for your answer Thomas, I supposed that this is forbidden for security reasons.

So, do you know another way?

For example, when I click on a tree node (that contains the path of the file), I was thinking to call a function (Z*) exporting the path where the file is stored (
SAPserver\folder\file.pdf) and importing the XSTRING content for showing that in an Interactive Form, do you know if its possible?

Thanks,

David.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>So, do you know another way?

Other than the workaround I described above? No not really. Not via client side access at least.

> I was thinking to call a function (Z*) exporting the path where the file is stored (
SAPserver\folder\file.pdf) and importing the XSTRING content for showing that in an Interactive Form,

There is no function module or class that will let you read from the client when running Web Dynpro. These function modules/classes require a connection to the SAPGUI (RFC) and no such connection exists when you are running in the browser.

The only other work around is if the files are store on a server and exposed via a network share, you could access them from the server side instead of the client side. The ABAP server can read/write files from the application server file system (including directories mounted across the network) using the ABAP DATASET commands.

Answers (2)

Answers (2)

Former Member
0 Kudos

Perfect! I've tried with the OPEN DATASET and READ DATASET into XSTRING var, bound this with the context and the PDF is shown.

Thaks so much!

David.

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

>

> Hi Experts,

>

> I have read lots of posts, but any post could help me. Perhaps this post may help more people.

>

> I have to upload a PDF file to show its contents either implace or in a new window. The FileUpload UI Elements is useless because it needs the interaction of the user. Can I write some code to decide the path of the FileUpload UI Element at runtime without the interaction of the user?

>

> Thanks,

> David.

Short answer - not really. This is a browser security restriction. You could imagine the danger if web applications from the Internet could just upload files from anywhere on your PC without your interaction. That would be a huge security risk.

The only exception might be the ACFUpDownload UI element in NetWeaver 7.01 and higher. This UI element is designed for uplaods to the KPRO/Content Server. However it can be used to upload to Web Dynpro directly as well:

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/109b9b52-bc00-2c10-8786-e4c5e96d...

https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70645070-bb00-2c10-f086-f126721a...

This UI element uses a signed Java Applet to get around the browser security restrictions. It also requires a security Whitelist to be maintained in the IMG and downloaded to the client machine to control which directories are available for access.

Meeting those requirements does allow you to do silent file uploads.