8

CDS View - Consumption View multiple default value... - SAP Community

 7 months ago
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.
neoserver,ios ssh client

CDS View - Consumption View multiple default values
celo_berger

celo_berger

Active Participant

on

‎10-19-2017

I'm building a consumption CDS view where I need to set multiple default values for a specific consumption filter:

80745-1.png

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)

icon_anonymous_message.png

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.

2232580-image.png

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

Paul_Fox_GER

Paul_Fox_GER

Explorer

‎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

eralper_yilmaz

eralper_yilmaz

Participant

‎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

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

But there is not an explicitly shown sample for your case


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK