I want to upload csv/excel file into a folder in HANA. All the examples I have seen so far is to store files into table as blob. Is it even possible to upload file to folder/directory into hana using sapui5? Please guide.
Thanks
I want to upload csv/excel file into a folder in HANA. All the examples I have seen so far is to store files into table as blob. Is it even possible to upload file to folder/directory into hana using sapui5? Please guide.
Thanks
It is possible, but I don't really recommend it. Keep in mind that the HANA repository is meant for design-time development artifacts and not for storing data as you would do in e.g. a document store.
In any case, there is a File API that you can use to write files using REST-style HTTP requests. You can read more about it in the official documentation and in the official reference.
In a nutshell, you will need to make a PUT / POST request as specified in the documentation. With POST you create empty files, so you should use PUT.
As an extension of the Orion specification, you can create files can using the PUT method. File creation using POST is also supported.
Looking at UI5's FileUploader API, I don't see any way to change the HTTP method. That being said, I guess that you should use plain jQuery for the file upload (see How to upload a file using an HTTP "PUT" using JQuery?). You should make sure to not use multipart content type (as the REST API seems to expect a "simple" upload (i.e. header + body which is the file itself).
Another more "wacky" solution (which I have actually implemented in the past) is to create a specialized REST service which:
What would be the expected result for your file upload? Should the files be retrievable from HANA as files or do you want the data from the files to be fed into table structures?
If, for example, you want to establish a data loading scheme, where one can drop CSV files (of a previously known structure) into a directory and the data from those CSV files get automatically loaded into HANA tables, then I'd recommend to check out the smart data integration (SDI) and its file adapter. See the SAP HANA documentation - SAP HANA Smart Data Integration and SAP HANA Smart Data Quality for details on this.