cancel
Showing results for 
Search instead for 
Did you mean: 

File Download UI

selvakumar_mohan
Active Participant
0 Kudos

Hi All,

Can you please help me in how to use the file download UI. The file to be downloaded is .pdf.

Please help me with the steps involved in the same.

Thanks,

selvakumar M.,

Accepted Solutions (1)

Accepted Solutions (1)

uday_gubbala2
Active Contributor
0 Kudos

Hi Selva,

You just need to bind the "data" property of the FileDownload UI element with a context attribute of type XSTRING. You should somehow read the content of the pdf, convert it into an XSTRING format and assign that value to the XSTRING attribute. The "text" which you maintain for the FileDownload UI element appears for the user as an LinkToAction. When he/she clicks up on that particular text, the system reads the data in the XSTRING attribute & converts it into the corresponding data. So your major task would be to read & convert the PDF file into XSTRING format. The rest of the process is very straightforward.

Regards,

Uday

selvakumar_mohan
Active Participant
0 Kudos

Hi Uday,

Can you please provide me on info of how to convert the .pdf file into XSTRING format.

Thanks for the quick turn around.

Thanks,

selvakumar M.

uday_gubbala2
Active Contributor
0 Kudos

Hi Selva,

Was just wondering as to how did you manage to upload a PDF file? If it were through the FileUpload UI element then the system would read the pdf file, convert it into XSTRING format & save the contents in the attribute bound to its "data" property. You can then even bind your FileDownload UI element to the same XSTRING attribute to which even the FileUpload UI element is bound to...

Regards,

Uday

uday_gubbala2
Active Contributor
0 Kudos

Hi Selva,

You can try make use of the CONVERT_OTF FM & the ATTACH_FILE_TO_RESPONSE method of class CL_WD_RUNTIME_SERVICES instead of using the FileDownload UI element.

Regards,

Uday

call function 'CONVERT_OTF'
exporting
format = 'PDF'
importing
bin_filesize = pdf_size
bin_file = LV_PDF
tables
otf = lt_otfdata[]
lines = l_dummy
exceptions
err_max_linewidth = 1
err_format = 2
err_conv_not_possible = 3
others = 4.
if sy-subrc 0.
message id sy-msgid type sy-msgty number sy-msgno
with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
endif.

lv_string = filename

cl_wd_runtime_services=>attach_file_to_response(
i_filename = LV_STRING
i_content = lv_pdf
i_mime_type = 'pdf/application'
i_in_new_window = abap_false
i_inplace = abap_false ).

This will open a popup same as when u download some file...

Regards

Uday

selvakumar_mohan
Active Participant
0 Kudos

Hi Uday,

Nope i havent used that UI element.

I will tell you the exact requirement.

The File will be present in a file server. I will be provided with the URL of the same. I have only this information.

So when the user clicks on the button or a link the file must be downloaded from there.

Please help me on this.

Thanks,

selvakumar M.

selvakumar_mohan
Active Participant
0 Kudos

Hi Uday,

How would i pass that file to that function module you have specified.

thanks,

selvakumar M.

uday_gubbala2
Active Contributor
0 Kudos

Hello Selva,

Am sorry just forget that CONVERT_OTF approach. You were saying that you would be given the URL location where you have the file & that you would have to download it from there. Try go through Thomas Jung's comments in this [thread |;wherein he discusses about the same exact requirement.

Regards,

Uday

Answers (0)