Skip to Content

How to call OData from sapui5 application in webide

Feb 06 at 09:51 AM


avatar image

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.



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

1 Answer

Sagarika Gattu Feb 06 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"); } } );

10 |10000 characters needed characters left characters exceeded