Skip to Content
-1

SAPUI5 - OData don't show any data

I make an SAPUI5 application and deploy in my abap server.

I need to acess the url http://my_gateway_system:port/sap/opu/odata/sap/ZGW_TRANSF/ztest_nameset('RUBENS') via OData.

When I copy this URL and past in my browser I get some data, but when I run my application, isn't get any data

Below is my code where I call the OData

var sServiceUrl = "http://<my_gateway_system>:<port>/sap/opu/odata/sap/ZGW_TRANSF";
    var oModel = new sap.ui.model.odata.ODataModel(sServiceUrl, true, "username", "password");

    var oJsonModel = new sap.ui.model.json.JSONModel();

    oModel.read("/ztest_nameset('RUBENS')", null, null, true, function(oData, response) {
        oJsonModel.setData(oData);

    });
    sap.ui.getCore().setModel(oJsonModel);
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Apr 27, 2017 at 09:48 AM

    Hi ,

    You can't access URL directly like this http://<my_gateway_system>:<port>/sap/opu/odata/sap/ZGW_TRANSF, it will give Cross origin error ..you need to use the relative paths .. if you have deployed your ui5 app in the gateway system (same where you have your service)

    thanks

    Viplove

    Add comment
    10|10000 characters needed characters exceeded