Skip to Content
avatar image
Former Member

error while calling odata

Hi all,

while calling odtaa i am geting

XMLHttpRequest: Network Error 0x4c7, The operation was canceled by the user.

pls help....

var sServiceUrl = "https://ldcisd4.wdf.sap.corp:44302/sap/opu/odata/sap/ZBOOK_SRV_01/ZBOOKINgSet?$format=json"; var post = $.ajax({ url : sServiceUrl, type : "GET" }); that = this; post.done(function(data) { var oModel = new sap.ui.model.json.JSONModel(); oModel.setData(data); that.getView().setModel(oModel); });

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Sep 25, 2017 at 11:25 AM

    Use the following code to call an OData service :-

    var modelo =new  sap.ui.model.odata.v2.ODataModel("proxy/http/services.odata.org/V2/OData/OData.svc/");

    This is the standard way in SAPUI5 to call an model. You can use AJAX also, but the sap.ui.model class makes it easier to work with the OData service.

    Hope this helps,

    Add comment
    10|10000 characters needed characters exceeded

  • Sep 25, 2017 at 05:51 AM

    Hello,

    Use a JSONModel :)

    I mean, instead of using $.ajax call, use loadData from JSONModel, you will see it is easier ;)

    Add comment
    10|10000 characters needed characters exceeded