cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with sap.ui.core.util.ExportTypeCSV

aashima123
Newcomer
0 Kudos
185

Hi all,

I'm getting an error while downloading the file into excel (Uncaught TypeError: sap.ui.core.util.ExportTypeCSV is not a constructor). on 

var oExport = new sap.ui.core.util.Export({
                    exportType: new sap.ui.core.util.ExportTypeCSV({
                        separatorChar: "\t",
                        mimeType: "application/vnd.ms-excel",
                        charset: "utf-8",
                        fileExtension: "xls"
                    }),
View Entire Topic
boghyon
Product and Topic Expert
Product and Topic Expert
0 Kudos

Make sure to declare the dependent modules in the dependency list of sap.ui.define or sap.ui.require.

sap.ui.require([ // Require and initiate those modules on-demand
  "sap/ui/core/util/Export",
  "sap/ui/core/util/ExportTypeCSV",
], (Export, ExportTypeCSV) => {
  const export = new Export({
    exportType: new ExportTypeCSV({/*...*/}),
    // ...
  });
  // ...
})

Generally, modules can be part of a preloaded library bundle (here: sap/ui/core/library-preload.js), but they still need to be properly required or declared like in my code snippet above. Do not rely on the global name of the module export either.

While classes like sap.ui.core.util.Export and sap.ui.core.util.ExportTypeCSV are deprecated, deprecated modules will be removed only in the next major release e.g. when upgrading from SAPUI5 1.x to 2.x.

Please review the section "Defining and Requiring Modules" and the rest from Best Practices for Developers - SAPUI5 documentation.