Skip to Content
1
Former Member
Oct 16, 2015 at 09:34 AM

oData v2 submitChanges Error Handling

2593 Views

Hi,

I'm having trouble with the calback functions of the submitChanges() method JsDoc Report - SAP UI development Toolkit for HTML5 - API Reference - sap.ui.model.odata.v2.ODataModel

My code is as follows:

oDataModel.setUseBatch(true);

oDataModel.create("/SomeEntity", data, {
    "changeSetId": "create"
});

oDataModel.callFunction("/SomeFunctionImport", {
     "method": "POST",
     "changeSetId": "function"
});

oDataModel.submitChanges(function(oEvent){
     alert("Success");
}, function(oEvent){
     alert("failure");
});

The submitChanges call goes through without any problems. The problem is that the error/success handlers doesn't get called. The documentation has the following note:

"Important: The success/error handler will only be called if batch support is enabled. If multiple batchGroups are submitted the handlers will be called for every batchGroup."

But I am setting the Model to use batch?

Using the model's event handlers doesn't work because they get called for every request that my model make, I only want to handle the specific submitChanges() calls.

Regards