cancel
Showing results for 
Search instead for 
Did you mean: 

ODATA CRUD

Former Member
0 Kudos

Hi, I am trying to implement a CUD app for a while now and have chosen to go the oDATA route

Reading data is has been an easy one

While I though create update and delete would ply the same road, I guess its another ball game,

How can you assist with

var oModel = new sap.ui.model.odata.ODataModel("http://myServer/Sentiments/services/contacts.xsodata");

  oModel.remove('/ContactsList(1)', null, function(){

  alert("Delete successful");

  },function(){

  alert("Delete failed");});

I get a failed Alert, Imagine that, What COuld i be doing wrong, permissions, security, headers...etc

This is all I have in my contacts.xsodata file service namespace "sap.hana.contact.service" { "SYSTEM"."BMBFRIENDS" as "ContactsList"; } Below is the example I want to test with as shown in the API reference

DELETE http://server/Sentiments/services/contacts.xsodata/ContactsList(1) 400 (Bad Request)d

Thanks for your help

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

And Yes I have Solved this problem by taking a very good rest before reading the documentation

Remember to do a forced clear cache especially in Chrome

The correct URL should be

http://server/Sentiments/services/contacts.xsodata/ContactsList('1')

code

var oModel = new sap.ui.model.odata.ODataModel("http:/mySecretIP/Sentiments/services/contacts.xsodata",false);

  oModel.remove("/ContactsList('1')", null, function(){

  alert("The Delete successful");

  },function(){

  alert("The Delete failed");});

Where contacts.xsodata is the name of .xsodata definition file

and /ContactsList is the alias name you gave to your database, view or datasource if you are using HANA

Hope this help me in the future or you presently

Answers (0)