Skip to Content

exportData() method of sap.ui.table.Table exporting Excel with empty values.

Hello UI5 Gurus,

In my view I have a table created using sap.ui.table library , I have given it a custom id "TAB2"

Now in my controller side I have written code for Downloading Table control data, I have attached screenshot.

I am getting Excel file downloaded , but its with empty contents.

Can anyone please suggest, what needs to be rectified.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

3 Answers

  • Dec 12, 2017 at 12:23 PM

    I tried as mentioned in SAP document also but it is also giving empty contents.

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    Dec 21, 2017 at 02:41 PM

    Hi Sijin,

    Please look at the following code:

    OnExcelAssets: function(oEvt){
                var oModel = this.getView().getModel("masterView");
                var oData = oModel.getData();
                var oTab = this.getView().byId("TAB2");
                var oBinding = oTab.getBinding("items");
                var oExport = new Export({
                    exportType : new ExportTypeCSV({
                        separatorChar : ";"
                    models : this.getView().getModel("masterView"),
                    rows : {
                        path : "/myAssets",
                        filters: oBinding.aFilters
                    columns : [{
                        name : this.getResourceBundle().getText("actCol1"),
                        template : {
                            content : "{Anln1}"
                    }, {
                        name : this.getResourceBundle().getText("actCol2"),
                        template : {
                            content : "{Txt50}"
                        name : this.getResourceBundle().getText("actCol6"),
                        template : {
                            content : "{Zzestadotxt}"
    onExcel: sap.m.Table.prototype.exportData || function(oExport){
                var vText = this.getResourceBundle().getText("errorPressExcel");
                // download exported file
                oExport.saveFile().catch(function(oError) {
                    //Handle your error
                }).then(function() {



    Add comment
    10|10000 characters needed characters exceeded

  • Dec 21, 2017 at 02:29 PM

    Hi Sijin,

    Table objects are tricky. Have you tried this:

    var oTable = this.getView().byID("TAB2");
    // oTableRows will contain the visible data on your table in json format - so you can pass it to the sap.ui.core.util.ExportTypeCSV
    var oTableRows = oTable.getBindingInfo("rows");

    This is just the beginning of it. I had to develop an utility library to be able to export data. That is because the view component (table) will contain only the displayed values. If you perform filters, or sorters of any kind, your export will be useless. Let's say you limit the table to 5 rows. Your export will have just 5 rows.

    The correct solution should be to base your export function on what the full OData output. So you need to retrieve the filters, sorters and selected columns to "mimic" the data the user "thinks" they are seeing and then call the service again passing the values back to the export functionality.


    Add comment
    10|10000 characters needed characters exceeded