on 08-27-2015 9:59 AM
Hi,
I use read/create/update/delete methods. These methods work fine because I pass in SAP debugger and all data are correctly read/created/updated/deleted in SAP from my UI5 interface values, but success and error callback functions aren't called.
Here is an example from my development :
oKunnrSet= this.oComponent.getModel();
oKunnrSet.read("/KunnrSet('USER')", null, null, true,
function(oData, oResponse){
alert("Read successful");
},function(){
alert("Read failed");});
If I execute my request in SAP NetWeaver Gateway, status_code = 200.
Have you an idea why success or error function are never called ?
I worked on SAPUI5 Version 1.26.9
try that:
oKunnrSet.read("/KunnrSet('USER')", {
async : false,
success : function(oData, response) {
console.log("Read successfull");
},
error : function(oError) {
console.log("Read failed");
});
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Read and remove are very similar, but the create and the update request also need the data you want to store as a parameter:
create(sPath, oData, mParameters?)
update(sPath, oData, mParameters?)
example:
oModel.create("BHEintragSet", {
"Bpartner" : oData.Bpartner,
"Kjahr" :oData.Kjahr,
"Hjahr" : oData.Hjahr,
"Xdel" : ""
}, {
async : false,
success : function(oData, response) {
iSuccess++;
sSuccessMessage += oView.getModel("i18n").getProperty("NewEntry") + ": " + oData.Kjahr + " " + oData.Hjahr + "\r\n";
},
error : function(oError) {
iFail++;
var oResponseBody = JSON.parse(oError.response.body);
oView.getController().createMessageItem("Error", sSaveFailure,oData.Kjahr + ((oData.Hjahr)? " - " + oData.Hjahr : "") + " : " + oResponseBody.err or .message.value);
}
});
}
I have always the same problem for CREATE, UPDATE and DELETE... I try to implement the same solution that READ, but success and error function doesn't called.
Can you give me an example for create, update and delete with success and error function callback ?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
var oBindingInfo = {
filters : aFilters,
success : function (oData) {
jQuery.sap.log.info("Odata Read Successfully:::");
}.bind(this),
error: function (oError) {
jQuery.sap.log.info("Odata Error occured");
}.bind(this)
};
if (oModel) {
oModel.read(sPath, oBindingInfo);
}
I hope this might help you.
Thanks.
Sarath.
This message was moderated.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Please provide your network and console after you called read().
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
try,
oKunnrSet.read("/KunnrSet('USER')", null, null, false,
function(oData, oResponse){
alert("Read successful");
},function(err){
alert("Read failed");});
JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.odata.ODataModel
User | Count |
---|---|
80 | |
9 | |
9 | |
7 | |
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.