Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

How to remove fieldgroups in adapt filters in VDM CDS view

former_member241519
Discoverer
0 Kudos

Hi,

I want to control how many fieldsgroups should be seen in the adapt filter.

I tried following things, but in vein.

@UI.hidden: true

_InspLot._Plant.PlantName,

this work fine for the field that u don' want to expose to ui,

I tried @consumption.filter.hidden: true , this also doesn't worked like i want.

all the association that i am exposing all are part of adapt filter by default.

This default functionality i want to control and expose only required field for filtering.

How to achieve this in smart temple?

4 REPLIES 4

0 Kudos

Hi Shiva,

Please check if below solution helps.

#1 - Remove the field group annotations for the field which you don't want to show up in the adapt filter list (this will push the field to default grouping, not to basic)

#2 - You need to set the odata filterable property of field as false; as of now the cds annotations are not seting this property, so you can do this using ABAP in the define() of the MPC_EXT class. Below is sample code for it.

model->get_entity_type( '<your entity name>' )->get_property( '<your desired property>' )->set_filterable( abap_false ).

former_member612018
Discoverer
0 Kudos

Hi Shiva,

Were you able to resolve this issue.? Even I need to hide Field Groups in adapt filters. Can you please suggest me with the steps.

Regards,

Surya

smarchesini
Active Contributor
0 Kudos

Hi Shivakumar,

I've the same issue, did you find the solution?

regards,
Sebastiano

smarchesini
Active Contributor

Hi shivakumar.shivakumar ,

I've found the solution in my cds:

In the cds of Interface :

define view ZCDS_SHOPDESC_F2_LS as select distinct from ZCDS_SHOPDESC_F_LS
association to ZCDS_ITMTYP_TX on $projection.item_type = ZCDS_ITMTYP_TX.item_type and ZCDS_ITMTYP_TX.langu = $session.system_language
association to ZCDS_ITEMDATA_I as _itemdata on $projection.guid = _itemdata.guid
 {
    @EndUserText.label: 'External ID'
     @ObjectModel.text.element: ['shop_descr']
     @Search.defaultSearchElement: true
    key external_id,
    
    @UI.hidden: true  
    guid,
    
    @EndUserText.label: 'Shop Description'
    @Search.defaultSearchElement: true
    @Search.ranking: #HIGH
    @Semantics.text: true
    shop_descr as shop_descr,
    @UI.hidden: true
    status,
    @EndUserText.label: 'Status'
    status_desc,
    @UI.hidden: true
    item_type,
    @EndUserText.label: 'Sap Code'
    sap_code,
    @UI.hidden: true
    ZCDS_ITMTYP_TX.item_type_t as itm_typ_desc,
    
    //info country and region
     @EndUserText.label: 'Geo Area'
     @ObjectModel.text.association: '_geoarea'
     //@Search.defaultSearchElement: true
    _itemdata.geo_area,
    
     @EndUserText.label: 'Country'
     @ObjectModel.text.association: '_country'
     //@Search.defaultSearchElement: true
    _itemdata.country,
    
     @EndUserText.label: 'Region'
     @ObjectModel.text.association: '_region'
     //@Search.defaultSearchElement: true
    _itemdata.region,
    
    @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
    @Consumption.filter.hidden: true
    _itemdata._geoarea,
    @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
    @Consumption.filter.hidden: true
    _itemdata._country,
    @ObjectModel.association.type: [#TO_COMPOSITION_CHILD]
    @Consumption.filter.hidden: true
    _itemdata._region
    
    }

@Consumption.filter.hidden: true

Over the association hide the field group , then over the sigle field hide the single filter.

Sebastiano 😉