on ‎2023 Aug 20 9:37 AM
Request clarification before answering.
Were you able to implement it in behavior implementation class or was it achieved using frontend?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
https://sapui5.hana.ondemand.com/sdk/#/topic/189e2d8a59f04a2693a4fde7f4a91a65
Seems like this is a frontend feature. You have to activate "createWithFilters" in your ListReport and redefine the hook that passes the filter values to the create page:
"component": {
"name": "sap.suite.ui.generic.template.ListReport",
"list": true,
"settings": {
"createWithFilters": {
"strategy": "extension"
}
}
}, getPredefinedValuesForCreateExtension: function (oSmartFilterBar) {
const oSelectionVariant = oSmartFilterBar.getUiState().getSelectionVariant();
const aSelectOptions = oSelectionVariant.SelectOptions;
const aRelevantProperties = ["UserName", "Telephone", "FullName"];
const aRelevantFilterValues = aRelevantProperties
.reduce((oRes, sProp) => {
const oSelectOption = aSelectOptions
.find(o => o.PropertyName === sProp);
if (oSelectOption?.Ranges.length === 1) {
const [filter] = oSelectOption.Ranges;
if (filter.Sign === "I" && filter.Option === "EQ") {
oRes[sProp] = filter.Low;
}
}
return oRes;
}, {});
return aRelevantFilterValues;
}, <br>
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi M S,
Mine is Managed scenario with oData v2, no draft.
I was able to activate "createWithFilters" in my ListReport. Now I see two dropdowns for the standard Create button- Create Object and Create with Filters.
However, I am not sure on how to redefine the hook that passes the filter values to the create page.
I do not see any option to define controller extensions on my Page Map.

I am very new to UI5 programming, so this could be a basic thing, but I am not able to get through it. Any pointers/references are greatly appreciated.
Hi,
I'm not sure if there's a way to achieve this using only RAP code.
Though, I think this is possible using a controller extension:
First, get the FilterBar ID using UI5 Inspector.
In my case, I have the following filters:

And this is the Filterbar ID shown in the UI5 Inspector

Then implement an extension:

I hope this helps.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 7 | |
| 6 | |
| 6 | |
| 6 | |
| 4 | |
| 3 | |
| 3 | |
| 3 | |
| 3 | |
| 2 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.