Skip to Content
-1
Jul 31, 2020 at 06:17 AM

How to call XSODATA service using create with hdbprocedure from SAP Web IDE (Neo)

231 Views Last edit Jul 31, 2020 at 06:26 AM 2 rev

Hi Experts,

1) I created the .hdbprocedure in SAP Hana Web Development Workbench.

PROCEDURE "TEST"."demo.test01::EmpInsert" (

IN new "demo.test01::Employee",

OUT error "demo_tz.test01::Err" )

LANGUAGE SQLSCRIPT SQL SECURITY INVOKER AS

BEGIN

DECLARE CURSOR c_cursor FOR SELECT EMP_ID, EMP_NAME, DEPARTMENT FROM :new;

SELECT "DEPARTMENT" INTO department FROM :new;

DELETE FROM "TEST"."demo.test01::Employee" WHERE DEPARTMENT= :department;

FOR cur_row as c_cursor DO

emp_id = cur_row.EMP_ID;

emp_name = cur_row.EMP_NAME;

emp_dept = cur_row.DEPARTMENT;

INSERT INTO "TEST"."demo.test01::Employee" VALUES (emp_id, emp_name, emp_dept); END FOR;

END

2) I created the xsodata using that procedure.

service {

"TEST"."demo.test01::Employee" as "Employee"

create using "demo.test01::EmpInsert" ; }

3) I created the SAPUI5 application at Web IDE Neo environment

My requirement is to create new data using xsodata from SAP Web IDE.

I would like to pass the json data array during xsodata service call.

I tried this, but it does not work although I am not sure it is allowed or not.

var oData = [];

oEntry2 ={"EMP_ID":"E0002","EMP_NAME":"Test User1","DEPARTMENT":"IT"};

oEntry2 ={"EMP_ID":"E0002","EMP_NAME":"Test User1","DEPARTMENT":"IT"};

oData.push(oEntry1);

oData.push(oEntry2);

oModel.create(sPath, oData, {success: function (){}, error: function (){});

What actions should I do to achieve the above requirement?

Please kindly provide references/samples.

Best Regards,

Thiri