I got multiple EntititySets which I want to update in my SAP Backend, therefore I fetch my data (payload) as JSON and put it in a request (its successfully in the node "data"):
Code:
var oTreeJSON = oTreeTable.getModel().getProperty("/root");
var oModel = sap.ui.getCore().getModel();
var batchChanges = [];
for (var i = 0; i < oTreeAll.length; i++) {
batchChanges.push(oModel.createBatchOperation("/sap/opu/odata/sap/MY_SERVICE/?$batch", "POST", oTreeAll[i]));
}
oModel.submitBatch();
My Request looks like this:
Where should it arrive in SAP (which method)? What am I doing wrong, there is no error anywhere, but no call arrived in my backend... Glad about every hint! Thanks.
Working example with reduced complexity:
var oEntry = {};
oEntry.MyId = "00000001";
oEntry.Value = "300";
batchChanges.push(oModel.createBatchOperation("MyEntitySet", "POST", oEntry, null));
oModel.addBatchChangeOperations(batchChanges);
oModel.setUseBatch(true);
oModel.submitBatch();
For the record, method calls:
oModel.addBatchChangeOperations(batchChanges);
oModel.setUseBatch(true);
In case you need set a breakpoint in backend for batch operations, just set a break point in method CHANGESET_BEGIN
or CHANGESET_END
.