I want to run a filter 2 times for 2 different values. The below filter runs fine and searches if the material M exists in the plant A. What I want to search is material M exists in Plant A and Plant B. So I want to run the below filter 2 times for Plant A search if the material is present then run for plant B. If both the places it exists then call the success function. Whats the best way to do it? (Plant is like the key)
Controller.js
var sServiceURL = self.getOwnerComponent().getMetadata().getManifestEntry("sap.app").dataSources["ABC"].uri;
var OdataModel = new sap.ui.model.odata.v2.ODataModel(sServiceURL);
var sPath = "/materialSet";
var filters = [];
filters.push(new sap.ui.model.Filter([
new sap.ui.model.Filter("plant", sap.ui.model.FilterOperator.EQ, self.plantA),
new sap.ui.model.Filter("plant", sap.ui.model.FilterOperator.EQ, self.plantB)
], true));
filters.push(new sap.ui.model.Filter("Material", sap.ui.model.FilterOperator.EQ, materialNo));
filters.push(new sap.ui.model.Filter("type", sap.ui.model.FilterOperator.EQ, orderType));
OdataModel.read(sPath, {
filters: filters,
success: self.sucess.bind(self),
error: function(oError) {
self.error(oError);
}
});