on 04-20-2015 10:58 AM
Hi Experts,
I created 1 Odata Service in SAP.
I test it in Gateway Client; it is working fine.
But when I am trying to consume the same in Eclipse.
I m failed get the data from SAP as default, also when I am creating a new Record; I am getting Creation failed as an error, which I placed on Creation Button.
Code for CREATE
function openCreateDialog(){
var oCreateDialog = new sap.ui.commons.Dialog();
oCreateDialog.setTitle("Create user");
var oSimpleForm = new sap.ui.layout.form.SimpleForm({
maxContainerCols: 2,
content:[
new sap.ui.core.Title({text:"Person"}),
new sap.ui.commons.Label({text:"Firstname"}),
new sap.ui.commons.TextField({value:""}),
new sap.ui.commons.Label({text:"Lastname"}),
new sap.ui.commons.TextField({value:""}),
new sap.ui.commons.Label({text:"City"}),
new sap.ui.commons.TextField({value:""}),
new sap.ui.commons.Label({text:"Email"}),
new sap.ui.commons.TextField({value:""}),
//new sap.ui.commons.Label({text:"Address"}),
//new sap.ui.commons.TextField({value:""}),
]
});
oCreateDialog.addContent(oSimpleForm);
oCreateDialog.addButton(
new sap.ui.commons.Button({
text: "Submit",
press: function() {
var content = oSimpleForm.getContent();
var oEntry = {};
oEntry.Vorna = content[2].getValue();
oEntry.Nachn = content[4].getValue();
oEntry.Ort01 = content[6].getValue();
oEntry.Mail = content[8].getValue();
//oEntry.Address = content[10].getValue();
sap.ui.getCore().getModel().create('/ZODATA1Set', oEntry, null, function(){
oCreateDialog.close();
sap.ui.getCore().getModel().refresh();
},function(){
oCreateDialog.close();
alert("Create failed");
}
);
}
})
);
oCreateDialog.open();
};
also, my application is not showing any Data when initially. I call it in Browser.
-Regards
Rohit
check in chrome debugger what is the actual reason of error.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I am getting;
http://uiserver.com:8000/sap/opu/odata/sap/zodata1_srv/$metadata 401 (Unauthorized)
XMLHttpRequest cannot load http://uiserver.com:8000/sap/opu/odata/sap/zodata1_srv/$metadata. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:49447' is therefore not allowed access. The response had HTTP status code 401.
Regards
Rohit
Hi,
I am getting;
http://uiserver.com:8000/sap/opu/odata/sap/zodata1_srv/$metadata 401 (Unauthorized)
XMLHttpRequest cannot loadhttp://uiserver.com:8000/sap/opu/odata/sap/zodata1_srv/$metadata. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:49447' is therefore not allowed access. The response had HTTP status code 401.
Regards
Rohit
This is the behavior of the web browser, You can find more about this issue in UI5 space in SCN. For a quick fix you may refer to javascript - Disable same origin policy in Chrome - Stack Overflow
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
6 | |
6 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.