cancel
Showing results for 
Search instead for 
Did you mean: 

File Download

Former Member
0 Kudos

Hello experts,

I wish to implement file download functionality.

I have got a BAPI, to which I need to pass the path where the file needs to be downloaded and some filename. When I execute this BAPI, the ECC backend sends a file to the specified path on the client with the mentioned filename.

In webdynpro screen, I wish to show a download popup where I can navigate to a path and specify the filename I wish to save the file as and then when I click on save, the above BAPI is called.

Is this possible in webdynpro? If yes, how?

Helpful answers shall be rewarded.

Thanks and best regards,

Nakul

Accepted Solutions (0)

Answers (2)

Answers (2)

nikhil_bose
Active Contributor
0 Kudos

yes, it is possible.

you have to use FileDownload UI Element which gives you option for where to save file and provide filename.

From RFC return value get a binary and create a resource and bind it to FileDownload -> Resource property

refer code:


byte[] data = wdContext.currentBAPI_Output().getFile().getBytes();
IWDResource resource = WDResourceFactory.createCachedResource(data, "name", WDWebResourceType.DOC);

nikhil

Former Member
0 Kudos

Hi Nikhil,

Thanks for your reply, but I already checked the file download UI element.

In the scenario which I need to build,

- User clicks on the download button

- A popup comes where user can navigate to a directory location and then type the filename in Save As box.

- Once the user click on Save button, Webdynpro calls a BAPI. This BAPI does not provide any return value but direclty place the file with the specified filename in the specified path.

So basically the webdynpro does not handle any file transfer (which is taken care by the BAPI directly). Hence as per the code which you provided I will not get any byte data back from the BAPI.

Best regards,

Nakul

nikhil_bose
Active Contributor
0 Kudos

so BAPI writes file to specified location.

use [Adaptive RFC|https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/a00f7103-6790-2a10-ac9c-fcac7c5b18a3] to create the bapi model and use it.

If you want user to input filename and location onAction of button click show a popup window which accepts the same. After that execute the RFC

PradeepBondla
Active Contributor
0 Kudos

Hi,

Why dont you use File Down load UI element?

PradeeP