Skip to Content
author's profile photo Former Member
Former Member

download without save dialog

Hi,

I use the method below to download attachment from BSP.

      lv_contenttype = 'application/octet-stream'.

          CONCATENATE 'attachment; filename=' lv_name
            INTO lv_contentdisposition.

          CALL METHOD runtime->server->response->set_header_field
            EXPORTING
              name  = 'content-disposition'
              value = lv_contentdisposition.

          CALL METHOD runtime->server->response->set_header_field
            EXPORTING
              name  = 'content-type'
              value = lv_contenttype.

          CALL METHOD runtime->server->response->set_header_field
            EXPORTING
              name  = 'content-filename'
              value = lv_name.

        lv_chunksize = 1022.
        LOOP AT lt_contents INTO ls_contents.
          MOVE ls_contents-line TO xwa.
          xwa_len = lv_file_size - ( lv_chunksize * ( sy-tabix - 1 ) ).

          IF xwa_len >= lv_chunksize.
            xwa_len = lv_chunksize.
          ENDIF.
          runtime->server->response->append_data( data   = xwa
                              length = xwa_len ).
        ENDLOOP.

        navigation->set_parameter( name  = 'content_length'
                                   value = lv_file_size ).
        runtime->server->response->delete_header_field(
                  name = 'Cache-Control' ).
        runtime->server->response->delete_header_field(
                  name = 'Expires' ).
        navigation->response_complete( ).

But this only allow to download 1 attachment at each time?

I have a service ticket that tight with few attachments. On my BSP page, there is a download button, is it possible to download those attachments at the same time to desktop and without saving dialog pop out?

Kindly advise.

thanks,

ginnie

Add a comment
10|10000 characters needed characters exceeded

Related questions

2 Answers

  • Posted on Nov 26, 2007 at 11:54 AM

    Hi Ginnie,

    As far as I am aware this is the only method. The dialog popup is to prevent malicious code being run in browser without user intervention so it cannot be turned off.

    Regards,

    Patrick.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Nov 26, 2007 at 01:19 PM

    Hi Ginnie,

    I think Patrick is correct here. With IE you do not have the possibility to avoid the dialog. In Firefox it might be possible if the user has set a standard directory to save downloaded files to. But this configuration must be done on the client. You cannot control that from the server side of things (and if you think about it this is definitly a good thing as I don't want a server admin to store data anywhere on my hard drive).

    Regarding the multiple attachments: there are function modules on the NetWeaver application server to zip files into an archive. So I would recommend building an archive and sending the zip file back to the user. If I remember correct there is a weblog on SDN showing this exact thing (zipping multiple files into one archive and sending them back to the client).

    Best regards,

    Alexander

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.