on 09-21-2016 7:30 AM
Hello
I want to download my table into excel format.
I used the below code but it is taking all the fields from collection.
Download: function(){
var sServiceUrl = "/sap/opu/odata/sap/ZDEMO_GW_SRV_SRV/SalesOrderSet?$format=xlsx";
var encodeUrl = encodeURI(sServiceUrl );
sap.m.URLHelper.redirect(encodeUrl,true);
},
But my requirement is, suppose i have few fields/ columns from collection(entity set) and i applied filter as well.. And now i want to download what I am viewing on my screen.
Question in nutshell
How can i download only selected columns and filtered data from table to excel.??
Hi Kiran ,
There are two ways :
1. using SAPUI5 export class(sap.ui.util.Export) - refer this example ,as the download is using through the service not the visible table , you need to mention only those fields which you want in excel ..
example : SAPUI5 Explored
2. using HTML table tag download - refer the answer in this link , this will download what you view on the screen .
Note : its better to download using the service (entitySet) because this will give you actual content ,, while downloading what you see on screen will not be good option because some data which is not render on the page will be missing in the excel ..
Check your requirement use accordingly ...
thanks
Viplove
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Kiran ...
Go with this ... Exporting to Excel from sap.m.Table via csv | SCN ... actually in that the download is like that only ... i was also not able to do in proper format ... just now i see my code what i did in my project .. its very much similar to the above mentioned link code..
note : be sure the code links i am sharing are in csv format ... not excel
thanks
Viplove
Hi Kiran,
Change separatorChar as below :
instead of :
exportType : new sap.ui.core.util.ExportTypeCSV({
separatorChar : ";",
charset : "utf-8",
}),
use this :
exportType : new sap.ui.core.util.ExportTypeCSV({
separatorChar : ",",
charset : "utf-8",
}),
Regards,
Akhilesh
User | Count |
---|---|
85 | |
10 | |
10 | |
10 | |
7 | |
6 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.