

CDS View - Consumption View multiple default value... - SAP Community
source link: https://community.sap.com/t5/enterprise-resource-planning-q-a/cds-view-consumption-view-multiple-default-values/qaq-p/572854
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.


on
10-19-2017
I'm building a consumption CDS view where I need to set multiple default values for a specific consumption filter:
The current default value works perfectly. My issue is that I need to include a few more values in there, and I can't figure out the correct syntax or method to do so.
For example, I need Movement Type to default to 601 and 901.
What's the correct way to do this?
All the best,
Marcelo
Accepted Solutions (0)
Answers (6)

Former Member
05-02-2018
Hi Marcelo,
i Currently have the same problem. Did you find a solution?
Best regards,
Hendrik

12-08-2023
Hi all,
I have used the following code in my consumption view and it worked fine.

In the place of Companycode1,companycode2,companycode3.. use the key values of CompanyCode you want to display.
In the background I have made an association for I_companycode in the cube view and used below annotation for same field.
@objectmodel.foreignkey.association:'_CompanyCode'
Best Regards,
Vaishnavi Devi, N

12-10-2021
try to use to build your filter with case/when expression and use the annotations:
a.MovementType,
@UI.hidden: true
@Consumption.filter.defaultValue: 'Filter_X'
case(a.MovementType)
when '601' then 'Filter_X'
when '901' then 'Filter_X'
else 'NoFilter'
end as MyMovementFilter
Best regards
Is there a way to avoid some Values in a property?
For Example,
If I want to avoid John specifically.
$filter=EmployeeName ne 'John'
Is there a way to do this in CDS view or Fiori Elements?
Hi all,
did anyone find a solution to this problem in the meantime? I found this question in several other questions (unanswered) as well.
There should be a possibility for a default filter on multiple values...
Best,
Florian

10-25-2017
Hi Marcelo,
Do you want to have multiple single value for the select-option?
I could not see to define a set of values for
defaultValue
select
from vbak {
@Consumption.filter : {
selectionType : #SINGLE,
multipleSelections : true,
defaultValue : '1653000003'
}
vbeln, //several single values are allowed
Perhaps you have already checked, if not have a look at
But there is not an explicitly shown sample for your case
Recommend
-
9
Masaaki Arai October 23, 2021 8 minute read ...
-
9
Manasi Balagere April 30, 2022 5 minute read...
-
10
Zeshan Shafqat October 7, 2022 3 minute read...
-
7
Chau Nguyen Phuc December 3, 2022 1 minute read...
-
95
Search Questions and Answers
-
12
Umut Yazici December 17, 2022 1 minute read ...
-
44
Ravi Dave January 31, 2023 2 minute read ...
-
7
Mohamed Thariqki 23 minutes ago Session variables in CDS view association 7 Views
-
6
Overview Pages with Parameterized CDS view and RAP approach Skip to Content...
-
16
CDS View @Consumption.filter.defaultValue date range including today? ...
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK