cancel
Showing results for 
Search instead for 
Did you mean: 

Getting the Filter line by default in ALV.

Former Member
0 Kudos

Hi friends,

There is a requirement for me, wherein, i need to provide a default filter line when the page loads initially. Generally we get a filter line, when we filter on any of the fields available, but in my case, without filtering on any of the fields, i should get the filter line. Is that possible in real?

If yes, kindly provide me the appropriate code.

Thanks & Regards,

Akshay

Edited by: akshay0222 on Sep 15, 2011 1:00 PM

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

Please try the below code.you can find more solution in sdn.

This displays both the filter line and the FILTER option(rightside top)

DATA:

lv_value type ref to cl_salv_wd_config_table.

DATA: lt_fields TYPE salv_wd_t_field_ref,

ls_fields TYPE salv_wd_s_field_ref,

lr_field TYPE REF TO cl_salv_wd_field,

lr_filter TYPE REF TO cl_salv_wd_filter_rule.

CALL METHOD lv_value->if_salv_wd_field_settings~get_fields

RECEIVING

value = lt_fields.

LOOP AT lt_fields INTO ls_fields.

lr_field = ls_fields-r_field.

CASE ls_fields-fieldname.

WHEN 'VBELN'.

CALL METHOD lr_field->if_salv_wd_filter~create_filter_rule

EXPORTING

  • included = 'X'

operator = 'NE'

low_value = space

  • high_value =

RECEIVING

value = lr_filter.

WHEN 'ERDAT'.

WHEN 'ERZET'.

WHEN 'ERNAM'.

WHEN 'ANGDT'.

ENDCASE.

ENDLOOP.

Thanks,

Lavanya.

Former Member
0 Kudos

Hi Akshay,

Try to config your ALV , I guess you are using a config methode :

you have to use set_filter_filterline_allowed with abap_true :


DATA : alv_config_table  TYPE REF TO cl_salv_wd_config_table,
                        wd_table TYPE REF TO iwci_salv_wd_table.
.
. 

alv_config_table = wd_table->get_model( ).
alv_config_table->if_salv_wd_std_functions~set_filter_filterline_allowed( abap_true ). " This instruction

Best regards.