Skip to Content

Using Createentry() of odata V2 from SAP Ui5

Sep 21, 2017 at 01:12 PM


avatar image
Former Member


I am trying to create a new entry using sap.ui.model.odata.v2.ODataModel from SAP UI5 for inserting an entry into the table, but the new entry is not reflecting into the table.

Below is the xml and the controller code.

XML: Path binding on table

<Table id="wsrdetails" growing="true" growingThreshold="10"
backgroundDesign="Solid" inset="false" items="{path:'inprogdata>/TSet'}"
selectionChange="selChange" delete="ondelRow">


view controller: -

this.sServiceUrl = "proxy/-----------------/sap/opu/odata/SAP/ZEMPLOYEE_SRV/";
this.oModel = new sap.ui.model.odata.v2.ODataModel(this.sServiceUrl);
// this.oModel.setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay);

this.oModel.setDefaultBindingMode(sap.ui.model.BindingMode.TwoWay);"/NSet?$format=json", mParameters);
this.getView().setModel(this.oModel, "inprogdata");

Initial table entries are displayed on to the table.

On Add function:- to create new entry on add action

var oContext = this.oModel.createEntry("/TSet", { properties: { No: rowData.No,
Desc: rowData.Desc, Proj rowData.Pro,
Ondate: "" } });

this.oModel.submitChanges({success: mySuccessHandler, error: myErrorHandler});

Since the model is binded directly to the table expecting it to directly reflect the changes back into the table.. but that is not happening, any suggestion will be helpful.



10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

2 Answers

Jun Wu Sep 25, 2017 at 12:28 PM

it is simply that you can not achieve that with odata model which is bound to table directly

10 |10000 characters needed characters left characters exceeded
Arjun Biswas Sep 25, 2017 at 11:28 AM

I guess you might have made an error while calling and passing the arguments in the createEntry function. Are you getting any specific error ?

Show 2 Share
10 |10000 characters needed characters left characters exceeded
Former Member

I am not getting any error, the entry gets updated successfully in back end just that the table doesn't refresh auto. Since the binding is with the table i am expecting the table to be auto refreshed reflecting the new entry present in the model.

Former Member

Works fine, my bad was not filling the er_entity on successfully creation of entry. closing the ticket.