I need to pass a parameter in my OData.
The URL has to be like this:
http://my_gateway_system:port/sap/opu/odata/sap/ZGW_TRANSF_APPROVAL_SRV_02/ztest_nameset('RUBENS')
Below is my code:
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);
When I past the URL
http:// my_gateway_system:port/sap/opu/odata/sap/ZGW_TRANSF_APPROVAL_SRV_02/ztest_nameset('RUBENS')
in my browser, it works. But when I run my code, it's not working.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…