Skip to content

Commit

Permalink
New snippet: Batch odata call
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerem Kayacan committed Jul 14, 2021
1 parent 882664d commit baeffaf
Showing 1 changed file with 36 additions and 0 deletions.
36 changes: 36 additions & 0 deletions src/new/batch-odata-call.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
onProcess: function(oEvent) {
sap.ui.core.BusyIndicator.show();
var sButtonId = oEvent.getSource().getId();
var aSelected = this.byId("table").getSelectedItems();
var oModel = this.getModel();
oModel.setDeferredGroups(["batchFunctionImport"]);
for (var i = 0; i < aSelected.length; i++) {
oModel.callFunction("/Process", {
method: "POST",
urlParameters: {
"IProcessid": aSelected[i].getBindingContext().getObject().ProcessId,
"IAction": sButtonId.includes("approveButton") ? "A" : "C"
},
batchGroupId: "batchFunctionImport",
changeSetId: i
});
}

oModel.submitChanges({
batchGroupId: "batchFunctionImport",
success: function(oData) {
var oTable = this.byId("table");
oTable.removeSelections(true);
oTable.getBinding("items").refresh();
if (oTable.getSelectedItems().length > 0) {
this.getModel("worklistView").setProperty("/footerVisible", true);
} else {
this.getModel("worklistView").setProperty("/footerVisible", false);
}
sap.ui.core.BusyIndicator.hide();
}.bind(this),
error: function(oError) {
sap.ui.core.BusyIndicator.hide();
}
});
},

0 comments on commit baeffaf

Please sign in to comment.