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
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.
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