Hi Experts,
I am facing an issue while downloading big files as excel by using XSJS. The code for downloading excel is as below:
function downloadData() /* * This function downloads the data in form of an excel file. */ { var frDate = $.request.parameters.get('frDate'); var toDate = $.request.parameters.get('toDate'); var cCode = $.request.parameters.get('cCode'); var fin_query = "SELECT ..."; var conn = $.db.getConnection(); var pstmt; var rs; pstmt = conn.prepareStatement(fin_query); rs = pstmt.executeQuery(); while(rs.next()){ body += "\n" + format(rs.getString(32)) + //Company Code "\t" + format(rs.getString(27)) + //Business Area "\t" + format(rs.getString(55)) + //Branch . . . . ; } $.response.setBody(body); $.response.contentType = 'application/vnd.ms-excel; charset=utf-16le'; $.response.headers.set('Content-Disposition','attachment; filename=PoT.xls'); $.response.headers.set('access-control-allow-origin','*'); $.response.status = $.net.http.OK; }
The code works fine for smaller sets of data(Upto 10k records-File size of upto 3-4 MB), However it fails for larger data set.
After turning on the debug mode in XS Server, I am getting the below error for the big data ranges while running in Chrome:
Found the following errors:
===========================
out of memory (line 355 position 0 in /Reports/pot/services/Export.xsjs)
The Query runs independently in HANA Studio, and gives desired result.
Please let me know if there is a solution for this particular issue.
--
Thanks & Regards,
Shreepad