cancel
Showing results for 
Search instead for 
Did you mean: 

CDS View - Consumption View multiple default values

celo_berger
Active Participant
21,980

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

patrickpittoors
Explorer
0 Kudos

Hi Marcelo,

did you already find a solution for this?
I have seen some alternative solutions but haven't found a really 'good' approach for something so basic.

if your default values would , by accident, follow up each other you can use the @Consumption.filter.defaultValue together with the @Consumption.filter.defaultValueHigh but I myself also need several single values.

So all feedback welcome!

possible alternative solution I found,just mentioning:

https://blogs.sap.com/2017/09/29/trick-with-parameter-derivation-for-using-analytical-report-variant...

regards,
Sven

sudhir_vanap
Explorer
0 Kudos
Even I'm also facing same Issue, where requirement is to show multiple default values of Supplier Acc Group (LFA1-KTOKK) in selection parameter of FLP.

Accepted Solutions (0)

Answers (6)

Answers (6)

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

hajduk
Explorer
0 Kudos
This is good solution.
Former Member

Hi Marcelo,

i Currently have the same problem. Did you find a solution?

Best regards,

Hendrik

Paul_Fox_GER
Explorer
0 Kudos

Hi,

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

Paul

0 Kudos

Hi,

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?

0 Kudos

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

eralper_yilmaz
Participant
0 Kudos

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

in


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

https://help.sap.com/doc/cc0c305d2fab47bd808adcad3ca7ee9d/7.5.6/en-US/d60c0bf6798a481fb7412bc89934cb...

But there is not an explicitly shown sample for your case

celo_berger
Active Participant
0 Kudos

Thanks Eralper,

As you mention the link doesn't provide an example for multiple default values in a filter.

At this point, it doesn't matter if it's multiple single values or a range. As long as I can DEFAULT multiple values in the filter, I'd be able to satisfy my requirements.

Best regards,

Marcelo