Hey you ALV-Gurus!
I have the following problem:
I display an internal table in an ALV Grid using the newer version CL_SALV_TABLE.
Now I have the problem that I have to rebuild my internal table according to the table which is currently displayed in the ALV, so that means if the user changes the sorting of the ALV-table, my internal table must be sorted the same way etc. I already got the sorting to work, but here's my next problem.... THE FILTERS!
To get a current representation of the ALV-table I surely have to delete the rows from my internal table, which are currently filtered out, and this seems like a huge hurdle ...
Here is my current code (not working):
data lr_filters type ref to cl_salv_filters. " filter reference
data lt_filter type salv_t_filter_ref. " Filter Table
data ls_filter type salv_s_filter_ref. " Filter Row
data lt_selopt type salv_t_selopt_ref. " Select-Option-Table
data ls_selopt type ref to cl_salv_selopt. " Select-Option-Row
data lv_col_name type string. " Name of column
" get filters
lr_filters = mr_alv->get_filters( ).
lt_filter = lr_filters->get( ).
" filter table according to ALV-Filters
loop at lt_filter into ls_filter.
lt_selopt = ls_filter-r_filter->get( ).
lv_col_name = ls_filter-columnname.
* first attempt: try to define ranges with the given data, not possible
* data lt_filter_range type range of table_to_filter_type-(lv_col_name).
* data ls_filter_range like line of lt_filter_range.
* second attempt: try to delete rows from table with dynamic mapping, not possible
delete gt_dunn_copy where (lv_col_name) not in lt_selopt.
loop at lt_selopt into ls_selopt.
" here you can use ls_selopt->get_high( ), ->get_low( ), ->get_sign( ) etc ....
" third attempt: NO MORE IDEAS :( ....
endloop.
endloop.
I hope anyone of you has an idea how to handle this. I really can't understand why SAP didn't implement an easy way to get the currently displayed data of the ALV back, I would need that functionality that often and so I always have to programm a workaround, but also this seems sometimes not to work because of dynamic limitations of ABAP .... Sorry, I'm used to other programming languages and I am somehow dissapointed of ABAP (Objects) ...
So, I hope somebody can help me, if my problem isn't clear don't hesitate to ask,
thanks in advance,
regards Matthias