on 06-29-2018 12:12 PM
Hi,
Was trying to access ES5 system using OData,
but getting error in passing User ID and Password.
Can you please help.
Getting errors in debug window as
"jquery-dbg.js:9203 GET https://sapes5.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/ProductSet/ 401 (Unauthorized)"
"Failed to load https://sapes5.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/ProductSet/: No 'Access-Control-Allow-Origin'
header is present on the requested resource. Origin 'null' is therefore not allowed access. The response had HTTP status code 401."
The code is below.
<script>
var sURL1 = "https://sapes5.sapdevcenter.com/sap/opu/odata/IWBEP/GWSAMPLE_BASIC/ProductSet/";
var sUserID = "S000XXXXX";
var sPassword = "SXXXXX"
var oModel = new sap.ui.model.json.JSONModel(sURL1, true, {user:sUserID,password:sPassword});
sap.ui.getCore().setModel(oModel);
var oTable = new sap.m.Table("tableID", {
columns : [ new sap.m.Column ({
header:[ new sap.m.Label ({text: "Product ID"})]}),
new sap.m.Column ({ header :[ new sap.m.Label ({text: "Type Code"})]})
]
});
oTable.bindItems("/value", new sap.m.ColumnListItem("listItem",{
cells:[ new sap.m.Text({text: "{ProductID}"}),
new sap.m.Text ({text: "{TypeCode}"})
]}));
oTable.placeAt("content");</script>
Hi,
It's cross origin issue. Please define your odata service in manifest.json/Component.js
Thanks,
Irfan G.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
84 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.