Skip to Content
Aug 29, 2018 at 06:46 AM

How to prevent multi selection on UI via CDS annotation?


Hi all
I have the following SmartFilterBar:

As you can see, the SmartFilterBar allows multi selection but it should be only one selection possible.

I tried to archive this via CDS annotations as following:

@AbapCatalog.sqlViewName: 'ZMDCCLASSOBJECT'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Class object cosumption'
@OData.publish: true
define view ZMD_C_CLASS_OBJECT
  as select from ZMD_I_CLASSNUM_VH
  association [1..1] to ZMD_I_CLASSTYPE_VH as _ClassTypeValueHelp on $projection.ClassType = _ClassTypeValueHelp.ClassType
  association [1..1] to ZMD_I_CLASSNUM_VH  as _ClassNumValueHelp  on $projection.ClassType = _ClassNumValueHelp.ClassType
                                                                  and $projection.ClassNum = _ClassNumValueHelp.ClassNum
      @Consumption.filter.selectionType: 'SINGLE'
      @Consumption.filter.multipleSelections: false
      @Consumption.valueHelp: '_ClassTypeValueHelp'
      key ClassType,
      @Consumption.valueHelp: '_ClassNumValueHelp'
      key ClassNum,

The _ClassTypeValueHelp looks as following:

@AbapCatalog.sqlViewName: 'ZMDICLASSTYPEVH'
@AbapCatalog.compiler.compareFilter: true
@AccessControl.authorizationCheck: #NOT_REQUIRED
@EndUserText.label: 'Value help classification type'
@VDM.viewType: #BASIC
@Search.searchable: true
define view ZMD_I_CLASSTYPE_VH
  as select from tcla  as Type
    join         tclat as Text on Type.klart = Text.klart
  key Type.klart as ClassType,
      @Search.defaultSearchElement: true
      @Search.fuzzinessThreshold: 0.8
      Text.artxt as ClassText
} where Text.spras = $session.system_language;

How to prevent multi selection on UI via CDS annotations?