Skip to Content
-1

SAPUI5 - OData don't show any data

Apr 26, 2017 at 06:24 PM

66

avatar image

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);
10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

1 Answer

VIPLOVE KHUSHALANI Apr 27, 2017 at 09:48 AM
0

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

Share
10 |10000 characters needed characters left characters exceeded