Hi,
I am new to UI5 and so ODataModel. I have tied one table to an ODataModel.
How would I send request to a server so that I will have a new entry created at server end?
I googled this and I tried following:
1. Called createEntry method on ODataModel as follows:
sap.ui.getCore().byId("maintainRolesTable").getModel().createEntry("DERMASSIGNMENTSet",{
"DeUser":"C5192081",
"SeqNo":"X",
"Childbp":"C5192081",
"ChildbpName":"",
"Id":"2",
"RelationType":"",
"Parentbp":"I0656568",
"ParentbpName":""
});
2. I called then submitChanges method on the model as follows:
sap.ui.getCore().byId("maintainRolesTable").getModel().submitChanges();
This is giving error as follows:
When I try to use ajax call instead of these methods, I get error as follows:
var obj={
"Childbp": "C5192081",
"ChildbpName": "Supriya Kale",
"DeUser": "C5192081",
"Id": "8",
"Parentbp": "I0656568",
"ParentbpName": "",
"RelationType": "RESOURCE MANAGER",
"SeqNo": "1",
"metadata":{
"type":"ZSECENTRAL_SRV.DERMASSIGNMENT"
},
};
$.ajax({
type: "PUT",
dataType: "json",
url: "https://lsftdc00.wdf.sap.corp:1443/sap/opu/odata/sap/ZSECENTRAL_SRV/DERMASSIGNMENTSet",
data: JSON.stringify(obj)
}).success(function( msg ) {
alert('HI read operation complete....................................');
}).error(function(msg){
alert("error occurred");
});
Can anyone tell me if I am going wrong in calling methods? Help would be appreciated.
Thanks,
Supriya Kale