Cruncher
Cruncher

Reputation: 197

What is the correct dataURL including filters for sapui5 spreadsheet control

I am using the export to spreadsheet control in SAPUI5 ( "sap/ui/export/Spreadsheet" described under https://sapui5.hana.ondemand.com/#/api/sap.ui.export.Spreadsheet). When calling the odata Service without filters it works fine. When adding filters I get an 'uncaught in promise Unexpected Server Response' error in the frontend. What is the correct Url including filters that I have to specify under dataUrl?

Thank you for the help!

Christophe

So far I am trying with: dataUrl: "/sap/opu/odata/sap//?$filter=Export eq 'X'"

oSettings = {
    workbook: {
        columns: aCols,
        hierarchyLevel: "Level",
    },
    dataSource: {
        type: "odata",
        dataUrl: "/sap/opu/odata/sap/<myService>/<myEntitySet>?$filter=Export eq 'X'", 
        serviceUrl: oModelInterface.sServiceUrl,  
        headers: oModelInterface.getHeaders ? oModelInterface.getHeaders() : null,
        count: oBinding.getLength ? oBinding.getLength() : null,
        useBatch: true,
        sizeLimit: oModelInterface.iSizeLimit
    },
    worker: false,
};

var oSpreadsheet = new Spreadsheet(oSettings);
oSpreadsheet.build();

Upvotes: 0

Views: 1569

Answers (1)

krisho
krisho

Reputation: 1034

There is an API for the download URL. Just use oBinding.getDownloadUrl()

Just to be safe:

dataUrl: oRowBinding.getDownloadUrl ? oRowBinding.getDownloadUrl() : null

Reference: https://openui5.hana.ondemand.com/#/api/sap.ui.model.odata.v2.ODataListBinding

Upvotes: 1

Related Questions