sap.ui.define([
"sap/ui/core/mvc/Controller",
"SNRProcessing/model/formatter",
"sap/m/MessageBox",
"sap/ui/model/json/JSONModel",
"sap/ui/model/Filter",
"sap/ui/model/FilterOperator"
], function(Controller, formatter, MessageBox, JSON, Filter, FilterOperator) {
"use strict";
return Controller.extend("SNRProcessing.controller.Mainview", {
formatter: formatter,
onProcess: function(oEvent) {
var oTable = this.getView().byId("main");
var oContext = oTable.getSelectedContexts();
var ReqId = [];
var filter1 = [];
if (oContext.length <= 0) {
MessageBox.error("select atleast one request to process");
return;
} else {
oContext.forEach(function(oContextItem) {
ReqId.push(oContextItem.getObject().ReqId);
});
for (var i = 0; i < ReqId.length; i++) {
filter1.push(new Filter("ReqId", FilterOperator.EQ, ReqId[i]));
}
// console.log(filter1);
var lv_odataUrl = "<url>";
var oModel = new sap.ui.model.odata.v2.ODataModel(lv_odataUrl, true, "", "");
oModel.read("/ResulttblSet", {
method: "GET",
filters: [filter1],
success: function(oData, oResponse) {
console.log(oResponse);
},
error: function(oError) {
sap.m.MessageBox.alert("Error Saving Entries!!");
}
});
}
}
});
});
Hello All,
While passing the Filter parameter to read call I am facing below Error.