2017 Sep 19 10:50 AM
Is there an easy way of retrieving the ALV data that is displayed when there are also filters used on that ALV?
The ALV is an object of CL_GUI_ALV_GRID. When showing it to the user, there is a filter placed on it by default. The user also has a button that processes the data in the ALV. How can I make sure the process only works with the data that is displayed, even if the user places his own filters on the ALV?
e.g: An ALV gets created from an itab that has 10 rows, but because there is also a filter passed on the ALV, only 8 rows are showing. When pressing a button, I only want to work with the 8 rows currently showing to the user.
Thanks in advance.
2017 Sep 19 11:54 AM
2017 Sep 19 11:54 AM
2017 Sep 19 12:11 PM
Thanks, that is already really helpful, but this method gets me the entries that are NOT displayed. How would I best translate this to the displayed entries? I think filling a table with entries not displayed, copying the source table and then looping through this copy and checking if they are in the non-displayed entries to delete them is a little bit timeconsuming.
2017 Sep 19 12:53 PM
2017 Sep 19 1:11 PM
I ended up copying the source table, looping over the filtered entries and deleting those indexes from the copy of source.
" Copy original table
DATA(lit_buffer) = lt_disp_items.
" Get excluded rows
lo_alv_grid->get_filtered_entries(
IMPORTING
et_filtered_entries = DATA(lit_index)
).
" Remove excluded rows from buffer
LOOP AT lit_index ASSIGNING FIELD-SYMBOL(<index>).
DELETE lit_buffer INDEX <index>.
ENDLOOP.
2017 Sep 19 1:42 PM
2017 Sep 19 3:22 PM
Using method GET_FILTERED_ENTRIES you can get filtered values of the ALV. Exporting parameter ET_FILTERED_ENTRIES holds the filtered rows.