Skip to Content
0

sapui5 odata remove deep entity

Feb 16 at 05:40 AM

410

avatar image
Former Member

I am using oData reference services with read/write enabled. I am unable to delete entries with deep entity. For example I want to delete entries from entityset "Suppliers"

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

2 Answers

Nitin Kant Feb 19 at 06:16 AM
0

Hi Shweta,

Could you please describe the requirement in more precise way so that we can suggest you a solution.

Regards,

Nitin

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

http://services.odata.org/V2/(S(eqkutk5sla1b31tgi5etl5e0))/OData/OData.svc/

Above link is for read/write data.

I want to delete either of the entries from entityset "Suppliers" using sapui5 odata remove function.

but simple code for deletion is not working the way it did for "Products" entity set

this.oModel.remove("/Products(" + delelement + ")",

function(oResponse){ console.log(oResponse); },

function(oResponse){ console.log(oResponse); });

0
Nitin Kant Feb 24 at 02:07 PM
0

Hi Shweta,

You are not able to remove entry from "Suppliers" entity set because E-tag is maintained in "Suppliers" Entity set, which is not implemented in "Products" entity set. You can observe an E-Tag property with each entry in the URL :

http://services.odata.org/V2/(S(eqkutk5sla1b31tgi5etl5e0))/OData/OData.svc/Suppliers


So now you have to call the remove function along with the E-tag parameter of that specific entry you are going to delete as given below :

oModel.remove("/Suppliers(2)", 
{
eTag : 'W/\"2\"' ,
success: function(oData, response) { sap.m.MessageToast.show("Success"); }, error: function(response) { sap.m.MessageToast.show("Failed"); } });

Please do let me know if any doubt.
Regards,
Nitin

Share
10 |10000 characters needed characters left characters exceeded