cancel
Showing results for 
Search instead for 
Did you mean: 

Download multiple PDFs from web dynpro application

former_member450029
Participant
0 Kudos

Hi Experts,

I have a table which is having multiple PDFs.

How can I download these multiple PDFs to my desktop.

And also system should prompt dialogue box asking for storage location.

BR,

Eshwar

Accepted Solutions (1)

Accepted Solutions (1)

ramakrishnappa
Active Contributor
0 Kudos

Hi Eshwar,

Use class cl_abap_zip to zip the multiple files into zip folder and using attach_to_file_response( ) you can download the same.

Please refer to the below link

Hope this helps you.

Regards,

Rama

former_member450029
Participant
0 Kudos

HI,

I have used the below code, but PDFs are not getting opened.

Neverthless,

I want a pop up for asking the storage location.->Is this possible ?

DATA izip TYPE REF TO cl_abap_zip.

DATA zip_xstring TYPE xstring.

CREATE OBJECT izip.

        LOOP AT lt_pdf_data_all INTO ls_pdf_data_all.

             lv_title = ls_pdf_data_all-title.

             izip->add( name = lv_title

                   content = ls_pdf_data_all-pdf ).

           clear: lv_title,ls_pdf_data_all.

        ENDLOOP.

          zip_xstring = izip->save( ).

       cl_wd_runtime_services=>attach_file_to_response(

       i_filename      = 'adobe_form.pdf'"l_name

       i_content       = zip_xstring

       i_mime_type     = 'application/pdf')."l_mimetype ).


Below error is triggering when PDF is getting opened.


BR,

Eshwar

former_member184578
Active Contributor
0 Kudos

Hi,

You are converting the pdf files to zip and still using the mime type as pdf. Change the mime type to application/zip and the file extention in file name as myfiles.zip

Regards,

Kiran

ramakrishnappa
Active Contributor
0 Kudos

Hi Eshwar,

As suggested, you need to pass the mime type as zip not pdf.

cl_wd_runtime_services=>attach_file_to_response(

       i_filename      = 'adobe_form.zip'

       i_content       = zip_xstring

       i_mime_type     = 'application/zip' )


Regards,

Rama

Answers (1)

Answers (1)

former_member184578
Active Contributor
0 Kudos

Hi,

You can use FileDownload UI to download files or on Action of button/link you can download files using cl_wd_runtime_services= attach_file_to_response( ) method.

Regards,

Kiran