Skip to Content
Dec 12, 2014 at 07:48 AM

update data in ui5 through sap netweaver gateway


Hi experts!!

I am trying to update the data in my table in UI5 through sap netweaver gateway service .

I redefined the method for update but i am not able to hit my service through UI5.

this is the way i am defining my service path and assigning it to the model.

var service = "/sap/opu/odata/sap/z01_customer_srv_01/";

var oModel = new sap.ui.model.odata.ODataModel(service, true, "", "");


this is the way i am fetching the changed data from the cells of the table and storing it in a structure oData

var oData = {} ;

var selectedRow = oTable.getRows()[i];

oData.number = selectedRow.getCells()[0].getValue(); = selectedRow.getCells()[1].getValue();

oData.weight = selectedRow.getCells()[2].getValue(); = selectedRow.getCells()[3].getValue(); = selectedRow.getCells()[4].getValue();

oData.joindate = selectedRow.getCells()[5].getValue();

oData.salary = selectedRow.getCells()[6].getValue();

oData.currency = selectedRow.getCells()[7].getValue();

and now calling the update method of the service and assigning the value of keyfield i.e. in oData.number.

sap.ui.getCore().getModel().update("/cust_det('" + oData.number + "')"), oData , null, function()

but i am getting an error while running it in browser

Uncaught TypeError: Cannot read property 'context' of undefined

please help me out through this