cancel
Showing results for 
Search instead for 
Did you mean: 

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

balkrishna_meena
Explorer
0 Kudos

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.

pfefferf
Active Contributor
0 Kudos

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

balkrishna_meena
Explorer
0 Kudos

The data received is in the form of string.

$.request.body.asString();

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

Accepted Solutions (0)

Answers (0)