Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Insert rows into tables using OData

Hi all,

I am trying to insert row into a table,

var oEntry = {};

     oEntry.CustomerID = $("#p2_CID").val();    
     oEntry.Reference.Identifier = $("#Reference_Identifier").val();
     oEntry.Nickname = $("#p2_Nname").val();

var oModel = new sap.ui.model.odata.ODataModel("/xxx/xxx/services/customer.xsodata/",false, xxx, xxx);

  oModel.create('/customer', oEntry, null, function() {

   alert("Create successful");
  }, function () {
   alert("Create failed");

the table has a column name "Reference.Identifier", and when I set oEntry.Reference.Identifier = $("#Reference_Identifier").val()  I get an error

Uncaught TypeError: Cannot set property 'Identifier' of undefined

I don't know how to solve this issue ....

Not what you were looking for? View more on this topic or Ask a question