cancel
Showing results for 
Search instead for 
Did you mean: 

Select All doesnt work after filter

former_member193460
Contributor
0 Kudos

Hi All,

     I have a webdynpro ALV application which has a select all functionality. The button works fine as long as filtering isn't done.

If i do select all after a filter operation, It doesnt consider the filtered records instead it takes the whole record(before filter).

Please let me know what are the options:

Below is a snippet of code

CALL METHOD lo_value->if_salv_wd_table_settings~get_first_visible_row
     RECEIVING
       value = l_first.
   CALL METHOD lo_value->if_salv_wd_table_settings~get_visible_row_count
     RECEIVING
       value = l_total.

* Get the event ID
   event = r_param->id.
   IF event = 'SELECT'."select all button event
     lv_to = l_first + l_total - 1.
     lt_elements = lo_node->get_elements( from = l_first
                                                      to   = lv_to ).
     LOOP AT lt_elements INTO lo_element.
       lo_element->get_attribute( EXPORTING name = 'CHECKBOX_SEL'
                                  IMPORTING value = lv_selected ).
       IF lv_selected = space.
         lo_element->set_attribute(
             EXPORTING
               name =  `CHECKBOX_SEL`
               value = 'X' ).
       ENDIF.
       CLEAR lo_element.
     ENDLOOP.

Accepted Solutions (0)

Answers (3)

Answers (3)

former_member193460
Contributor
0 Kudos

I got lucky and figured out how to achieve my own requirement.

Scenario: filter condition and select all should select all the filtered values

Steps i have taken:

1) The "Select All" Method which is triggered by Event

2)In the method , i got the filter values

Code snippet:

lt_field_ref    = cl_salv_wd_model_table_util=>if_salv_wd_table_util_fields~get_filtered_fields(

    l_value ).

    LOOP AT lt_field_ref INTO ls_field_ref.

      lt_filter_rule = ls_field_ref-r_field->if_salv_wd_filter~get_filter_rules( ).

      CHECK LINES( lt_filter_rule ) GT 0.

      LOOP AT lt_filter_rule INTO ls_filter_rule.

        ls_selopt-low    = ls_filter_rule-r_filter_rule->get_low_value( ).

        ls_selopt-high   = ls_filter_rule-r_filter_rule->get_high_value( ).

        ls_selopt-option = ls_filter_rule-r_filter_rule->get_operator( ).

      ENDLOOP.

    ENDLOOP.

  ENDIF.

Please click on this link to get more details:http://scn.sap.com/thread/1638506

3) I traversed all the record and checked the fields values and compared it with the filter values.

4) If all the field where filter is used matches of a record , then that record checkbox will be selected, similarly for deselect all also.

Thanks Anyway

Cheers,

Tashi

former_member199125
Active Contributor
0 Kudos

Hope you can achieve it manually by maintaining 2 nodes..

first copy all values in 1st node, then in 2nd node keep your filter values.. bind the table with 2nd node...

upon filter action read the values in 1st node and then bind it to 2nd node.. then in table u will have only filter value, when no filter copy all the values in node1 to node2

Regards

Srinivas

former_member193460
Contributor
0 Kudos

Hi Experts,

     I am really struggling to accomplish the above mentioned requirement. i am not able to identify the records(elements) which are filtered so that i can select when "Select All" is pressed.

The closes thing i got was by following a solution provide by J Are:

http://scn.sap.com/thread/1638506

But even with the filter field and value , it is quite complicated to achieve the requirement.

Is there any way get_element ( giving filter field and values ) and get only the filter records ?

Please help

Regards,

Tashi