on 12-27-2016 12:55 PM
Hi All,
I am facing issue while calling a Function Import.
Below is my syntax,
var serviceUri = "https://******************/sap/opu/odata/SAP/ZTSUPRTSTATC_GW_SRV/";
var oModel = new sap.ui.model.odata.ODataModel(serviceUri, true, "user", "password");
sap.ui.getCore().setModel(oModel);
var parameters = { method:"GET",
urlParameters : { LowDate : firstDay,HighDate : lastDay },
success:function(oData, oResponse) {
console.log(oResponse);
console.log(oData);
var valor = oData.results[0].Name;
alert(valor); //"ok"
},
error:function(oError){
alert("Data retrieval was not successful!");
}
};
oModel.callFunction("PersonTaskTimespend", parameters );
Hi Everyone,
Very thanks for your time.
The issue was CORS issue and got it rectified by making the following changes to Service URI,
// var serviceUri = "https://*******.*****.******:####/sap/opu/odata/SAP/ZTSUPRTSTATC_GW_SRV/";
var serviceUri = "proxy/https/*******.*****.******:####/sap/opu/odata/SAP/ZTSUPRTSTATC_GW_SRV/";
So changing https:// with proxy/https/ made the code work.
I had faced the issue while working using WEB IDE , but there in browser Console it was clearly mentioned that CORS issue has been encountered and I got it rectified by prefixing https://cors-anywhere.herokuapp.com/
but now am using Eclipse and here it was not highlighted in browser Console that the issue was CORS.
Thanks,
Sijin
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
6 | |
6 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.