Skip to Content
avatar image
Former Member

Using Createentry() of odata V2 from SAP Ui5

Hi,

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'}"
mode="MultiSelect"
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);

this.oModel.read("/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.

Regards,

Narayan

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • 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

    Add comment
    10|10000 characters needed characters exceeded

  • 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 ?

    Add comment
    10|10000 characters needed characters exceeded