cancel
Showing results for 
Search instead for 
Did you mean: 

How to insert data into table by calling a procedure using xsodata?

former_member594414
Participant

Hi All,

Please bear if the question is amateur as I dont have much knowledge working with HANA XSA.

PROCEDURE "location"( )
   LANGUAGE SQLSCRIPT
   SQL SECURITY INVOKER
   AS
BEGIN
  insert into "new.new" values(333,80000,'Dummy1','Dummy2');
  commit;
END

The procedure works fine when I called. Now I have created a xsodata service "user.xsodata" and below is the code

service {
"new.new"
as "Adjustment" create using "location";
}

The intention of the xsodata is to invoke the procedure and insert the data into the table which is not happening. Pls help. I'm just getting the JSON output alone, inserting is not done.

former_member594414
Participant
0 Kudos

florian.pfeffer 9958e4b6df99431a84a41b015b639ac8 sreehari.vpillai can you pls help here

pfefferf
Active Contributor

Question for me is, why you need the procedure at all if it does nothing "special" compared to a "standard" insert of data, which can be done directly by the XSOData framework out of the box.

former_member594414
Participant
0 Kudos

Hi florian.pfeffer , thanks for the response. I understand your point, but this not the procedure I'm going to use in my project. The procedure which I will be using , will be bit complex than this.

I created this procedure just for testing purpose. The intention here is to test how procedure can be invoked via xsodata service. Hope I have set my point clear.

Accepted Solutions (0)

Answers (1)

Answers (1)

sreehari_vpillai
Active Contributor
0 Kudos

See if this help.

https://help.sap.com/viewer/4505d0bdaf4948449b7f7379d24d0f0d/2.0.00/en-US/81ccb259f8564776a4bcf0bb47...

one important point you must consider is , you are using a procedure to insert data to the table ( entity ) . How will you receive the payload in your procedure ? there is no "IN" / "OUT" in your given procedure. Above document says how you should manage the syntax .

-- sorry for late response.

Sreehari

former_member594414
Participant
0 Kudos

Hi Sreehari, thanks for the response. Just one more question, I need to expose either procedure/xsjs output which would be either a table/JSON respectively via xsodata. Is this possible? If so can u pls provide me a simple example? Whatever resources I have seen, it asks to use views for xsodata READ operations.

sreehari_vpillai
Active Contributor
0 Kudos

easy way to consume procedure ( read only ) and return the output is , use the procedure in a scripted calculation view and expose the calculation view as xsodata .

you cannot propagate xsjs response to xsodata unless you either code the logic in xsodata layer . why dont you use xsjs instead ?

https://blogs.sap.com/2014/06/23/transferring-complex-structured-data-from-ui-to-xsjs-posting-json/

Sreehari