cancel
Showing results for 
Search instead for 
Did you mean: 

How to get filter values node for ALV

ArtiBhat
Associate
Associate
0 Kudos

Hi Colleagues,

I need your help in knowing how to get the "Filter_values" node for a dynamic ALV.

I need it to define the filtering for a column .

I can set the data directly by using set_data( ) method but don't know how to bind table to node Filter values.

Kindly help.

Best Regards,

Arti.

Accepted Solutions (0)

Answers (2)

Answers (2)

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

I can set the data directly by using set_data( ) method but don't know how to bind table to node Filter values.

Can you please elaborate where are facing the issue and what exactly is you requirement.

Priya

ArtiBhat
Associate
Associate
0 Kudos

Hi,

In case of dynamic ALV we can bind the data to the "DATA" node by set_data( ) method of SALV_WD_TABLE componnet which we accessed outside this component also. Now I want to set the filter values to one of the columns which i know can be done through binding the data to the "FILTER_VALUES" node .

My questionis how to get the regerence of "Filter_values" Node. If I get this ref. my issue is solved.

Best Regards,

Arti.

Former Member
0 Kudos

Hi,

Is that requried...

Test it this way..

When you get the alv instantiated...try to get the field references for that alv and for that given field apply the filter....using

create_filter_rule method...

Regards,

Lekha.

Chaitanya_Priya
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi,

to set the filter value for a column you can proceed as follows:

Data: lr_filter_rule  TYPE REF TO cl_salv_wd_filter_rule,
  lr_column_settings TYPE REF TO if_salv_wd_column_settings,
    lt_columns         TYPE salv_wd_t_column_ref,
    ls_columns          TYPE salv_wd_s_column_ref,


  lo_cmp_usage =   wd_this->wd_cpuse_alv_table( ).
  IF lo_cmp_usage->has_active_component( ) IS INITIAL.
    lo_cmp_usage->create_component( ).
  ENDIF.
  lo_interfacecontroller =   wd_this->wd_cpifc_alv_table( ).
  lo_value = lo_interfacecontroller->get_model( ).


  lr_column_settings ?= wd_this->lr_config_table.
      lt_columns = lr_column_settings->get_columns( ).

LOOP AT lt_columns INTO ls_columns.
        l_col_index = sy-tabix.

        lr_column = ls_columns-r_column.

*get the field name by passing the column id.

     l_fieldname = cl_salv_wd_model_table_util=>if_salv_wd_table_util_column~get_field(
             r_model   = lo_value
             column    = ls_columns-id ).

*get field object reference

  lr_field = lo_value->if_salv_wd_field_settings~get_field(
           fieldname = l_fieldname ).

CALL METHOD lr_field->if_salv_wd_filter~CREATE_FILTER_RULE
  EXPORTING
*    INCLUDED   = 'X'
*    OPERATOR   = 'EQ'
    LOW_VALUE  = 'aaa' "enter value which you want to set.
*    HIGH_VALUE =
  RECEIVING
    VALUE      =  lr_filter_rule

.

You can refer the link

[http://help.sap.com/search/highlightContent.jsp]

Priya

.

Former Member
0 Kudos

After appyling the filter to alv for a field, do you want to retrive them...

Can you elaborate ..