Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Download file from SAPUI5 application.

Hi all,

my purpose is to dowload a file from a SAPUI5 application.

I found some discussion about this topic, but always using the sap gateway, but in my case this is not possible because I do not have the gateway.

In my scenario the user click on a file name in a list and through an ajax call I extract the file content in xstring format.

this is the code in the controller of my view

var oParameters = {
   title: oObject.phio_fname,   //filename
   type:  oObject.phio_ext,     //file type
   id:           //purchase order number


    //Ajax to back-end


   url : "/zui5/index.html?application=POA&area=DOWNLOAD_ATTACH",
   contentType : "application/json",
   dataType : 'json',
   data : oParameters
     });    //Ajax call completed

in my http handler



      input_length       = lv_bin_size


      BUFFER             = lv_xstring


      binary_tab         = lt_phio_content


*     FAILED             = 1

*     OTHERS             = 2        .

  ls_file-file_name     = lv_title.

  ls_file-file_type     = lv_type.

  ls_file-file_content  = lv_xstring.

server->response->set_data( data = ls_file-file_content ).
server->response->set_content_type( content_type = ls_file-file_type ).

Everything work correctly until the server response, but I am not getting any result in my page.

Is it possible to achieve this result without the gateway?

If not what I am missing?

Thanks in advance.

Former Member

Helpful Answer

Not what you were looking for? View more on this topic or Ask a question