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