Skip to Content

How to insert table data in the form of json array to the Column Table?

Jun 16, 2017 at 02:18 PM


avatar image

The scenario is, I have thousands of rows to be inserted into HANA DB.

What I have been trying is, I have created a function in XSJS and there I have parsed the data in the form of JSON.

var content = JSON.parse($.request.body.asString());

Now I pass this data to the Stored Procedure. and my Stored procedure accepts Table_Type as INPUT PARAMETER (IN).

when I do

var result = query(content);

(query : where I call the function, using ("sap.hana.xs.libs.dbutils", "procedures"))

I receive response - {"proc_param":"IT_CONTAINER"}

and when I do - var result = query(1,content)

I get-

{"argname":"IT_CONTAINER","argposition":0,"procedurename":"ADD_CONTAINERS_TEST","msg":"Table-value expected, found scalar"}

What I am doing wrong?

Is this the correct way to achieve what I am trying to do?

Please suggest if there is any other way to achieve the same.

10 |10000 characters needed characters left characters exceeded

What does the JSON.parse function produce? An object or an array? Maybe you can share an example.


The data received is in the form of string.


JSON.parse() parses the string into Javascript object.

* Please Login or Register to Answer, Follow or Comment.

0 Answers