cancel
Showing results for 
Search instead for 
Did you mean: 

setting the filter value in ALV

Former Member
0 Kudos

Hi All,

Can someone tell me as to how i can set the filter condition from my code for an ALV grid. My requirement is that i have to default the dislay to a filter condition. The user may then override it by specifying his/her own filter criteria later on.

Any help would be appreciated. Thanks.!

Regards,

Ram

Accepted Solutions (1)

Accepted Solutions (1)

sivasatyaprasad_yerra
Active Contributor
0 Kudos
sivasatyaprasad_yerra
Active Contributor
0 Kudos

Hi,

The following snippet of code will filter the column values which equals to the value 'BA'.

data: lr_field_settings type ref to if_salv_wd_field_settings,

lr_field_hdr type ref to CL_SALV_WD_FIELD,

lr_field type ref to CL_SALV_WD_FILTER_RULE.

lr_field_settings ?= wd_this->MAIN_ALV_CONFIG_TABLE. // ALV table name.

lr_field_hdr = lr_field_settings->get_field( '//column name' ).

lr_field = lr_field_hdr->if_salv_wd_filter~create_filter_rule( operator = 'EQ' low_value = 'BA' ).

So, now the column will be filtered by the value equal to 'BA'.

Regards,

Siva.

Answers (0)