Skip to Content
avatar image
Former Member

sapui5 odata remove deep entity

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"

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Feb 19 at 06:16 AM

    Hi Shweta,

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

    Regards,

    Nitin

    Add comment
    10|10000 characters needed 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); });

  • Feb 24 at 02:07 PM

    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

    Add comment
    10|10000 characters needed characters exceeded