From baeffaf6e5661c96ebbe68abbb6e21a568ee9695 Mon Sep 17 00:00:00 2001 From: Kerem Kayacan Date: Wed, 14 Jul 2021 19:38:45 +0300 Subject: [PATCH] New snippet: Batch odata call --- src/new/batch-odata-call.txt | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/new/batch-odata-call.txt diff --git a/src/new/batch-odata-call.txt b/src/new/batch-odata-call.txt new file mode 100644 index 0000000..671781f --- /dev/null +++ b/src/new/batch-odata-call.txt @@ -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(); + } + }); + }, \ No newline at end of file