Skip to Content

How to call OData from sapui5 application in webide

Hello Experts,

I have created a simple application in webide where I used query service to get table entries from backend system. I want to perform CRUD operations where I have some queries.

1. As there are two ways by which i can perform update operation using ODATA.update() method or using ODATA.REQUEST() object where we provide requestUri,method. Now my question is whoch method is better or preferred?

2. If we go for ODATA.update() method then how to get and pass XSRF token from header or is it automatically handled?

3. In case of ODATA.REQUEST() method, Is it safe to pass the requesURI value with Server port details.

Can you please provide your expertise on above questions.

Thanks in Advance for your help.



Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Feb 06, 2018 at 10:11 AM

    Hello ,

    you can try the below code

    ODataModel.update(sQuery,oEntry, { //oEntry is the array which I want to export to oData and sQuery is the entityset

    method: "PUT",

    error: function(e) { alert("error"); },

    success: function(data) { alert("success"); } } );

    Add comment
    10|10000 characters needed characters exceeded