- 30.11.2018 – Added screen shot how to set “Use Export to Excel” using the SAP UI5 Visual Editor
When displaying data in SAP Fiori applications users very often want to download the data in the Excel format. Already quite some time there was an option available that allowed to download data in the xlsx format by adding the query parameter $format=xlsx to the OData request.
This export functionality had however several restrictions as described in the SAP Online Help.
One of the most wanted features by customers was that the column headers in the Smart Table Control should be used as heading for the Excel file and only the columns that have been selected in the UI should be visible in the Excel file.
As of SAP UI 1.52 there is now a method setExportType available to leverage the UI5 client-side spreadsheet export service in the Smart Table control. Since the UI control “knows” about all the user specific UI settings it is able to apply them when exporting the data to Excel.
As described in the SAP UI5 online help setExportType sets a new value for property exportType which specifies the type of export to be used in the SmartTable control. The default value is
The “old” Gateway backend spreadsheet export service wasn’t able to enrich the exported Excel with this information.
If you now set the property useExportToExcel to true a button will be displayed that allows you to export data to a spreadsheet application, for example Microsoft Excel. But instead of using the “old” Excel Export functionality the new UI5 client-side spreadsheet export service will be used instead.
How to use the new feature in SAP Fiori elements List Reporting template
When you generate a SAP Fiori elements app using the List Reporting template using version SAP Innovation (1.54) it turns out that there is no button for exporting the data to Excel by default.
You can however use the UI Adaptation Editor or in newer releases of SAP Web IDE (as of Web IDE version 1809) the SAPUI5 Visual Editor to change the settings of the Smart Table control being used by selecting true from the Use Export To Excel drop down box.
For more Information see the blog post Adaptation Projects – it’s time for a new way to extend your Fiori Elements application of my colleague Jessica Merz .
UI Adaptation Editor
SAPUI5 Visual Editor
When you now run your application you will notice a new button on the right hand side.
If you press the button the data that you see in the UI will be downloaded in an Excel file.
Please note, that the headings of the columns now have the same order and the same description as the headings of the Smart Table control. (Here: Image, Product ID, Category, …)
If you change the order of the colums in your app this change is immediately reflected when exporting the data to Excel as well. (Here we have moved “Image” to the third column, so that we now have the following order: Product ID, Category, Image…)
Hope this will help.