Skip to Content
1
Jun 11, 2018 at 09:53 AM

SAPUI5: problem retrieving document from SAP gateway

2468 Views

Hi experts,

I implemented the GET_STREAM method in the sap gateway.

When I run the sap gateway client, I succeed downloading the file.

But when I try to do it from sapui5, I just get an error:

The following problem occurred: no handler for data

Cannot read property 'body' of undefined

Here is the code in the sapui5:

var sServiceUrl11 = "proxy/http/server:port/sap/opu/odata/SAP/ZFILEUPLOADDOWNLOAD_SRV/";
var oModel11 = new sap.ui.model.odata.v2.ODataModel(sServiceUrl11, true);
var fileName = "Questions.docx";
var sRead = "/FileSet('" + fileName + "')/$value";

oModel11.read(sRead,
{
    success: function(data, result) {
	console.log("success");
    },
    error: function(err) {
	console.log("error");
    }
});

Can someone please help?

Thanks in advance.