Skip to Content

How to read a file using XSJS on HANA?

Jun 16, 2017 at 03:25 PM


avatar image

I have an XSJS app and I would like to be able to read a file(text or CSV) and get the data from it. Then I'm making a data call to the backend to retrieve the data(this part already done) and I want to store that data into another file (text or csv). Unfortunately I haven't found any examples on how to read and write files in xsjs. The file I'm reading will be residing within the same package but I don't know what function to use to read the file. Can anyone point me to where to look?

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

Florian Pfeffer
Jun 16, 2017 at 04:01 PM

The SAP HANA REST File API can do the job for you.

But please consider that this is only valid for XS Classic. If you later wanna migrate to XS Advanced, this will not work anymore, because XS Advanced don't use the HANA repo (and you will for sure not use from an XS Advanced application the old XS Classic HANA Repo).

Maybe you think about your architecture, to not store your business files in the HANA Repot but in a document store or as a BLOB in a table.


Show 1 Share
10 |10000 characters needed characters left characters exceeded

With SDI/SDA (file adapter) it is possible to read files pretty easily. That also works with XSA.

But writing back is a bit more complicated, if not impossible, or?