Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
cancel
Showing results for 
Search instead for 
Did you mean: 
Dhanasupriya
Active Participant
1,537
Hello Team

Recently, I came across a scenario in SAP Fiori Elements List Report Object Page (LROP) where I need to filter the List Report table data in entity1 based on the Object page data in entity2.

Added a custom filter extension binding the entity2 to the sap.m.MultiComboBox control in List Report:



Given a number to length as I am getting only 1st 100 records. Now, I need to filter the List Report table holding entity1 data. Here in both the entities, there is a common field carrid which I gave as a key to MultiComboBox.

Here is the code I wrote in onBeforeRebindTableExtension method placed inside ListReportExt.controller.js to achieve my requirement.
	onBeforeRebindTableExtension: function (oEvent) {
debugger;
var customFilterItems = this.getView().byId(
"com.zlistreportobjectsample9::sap.suite.ui.generic.template.ListReport.view.ListReport::YTEST_FLIGHT_LIST--maxspace").getItems(),
mBindingParams = oEvent.getParameter("bindingParams"),
aSelectedItems = this.getView().byId(
"com.zlistreportobjectsample9::sap.suite.ui.generic.template.ListReport.view.ListReport::YTEST_FLIGHT_LIST--maxspace").getSelectedItems(),
aSelectedItemsArray = [],
aItemsArray = [];

aSelectedItems.forEach(function (oSelectedItem) {
aSelectedItemsArray.push(oSelectedItem.getText());
});

customFilterItems.forEach(function (oItem) {
aSelectedItemsArray.forEach(function (oSec) {
if (oSec === oItem.getText()) {
var oItemKey = oItem.getKey();
aItemsArray.push(oItem);
}
});
});

aItemsArray.forEach(function (oTextItem) {
mBindingParams.filters.push(
new sap.ui.model.Filter(
"carrid",
sap.ui.model.FilterOperator.EQ,
oTextItem.getKey()
)
);
});

},

Output:


Hope this helps someone who is googling this outline.

Thank you!!
BR// Dhanasupriya Sidagam

#EnhanceLearning
Labels in this area