‎2015 Sep 07 7:10 PM
I am using a CL_SALV_TABLE in fullscreen mode. The ALV is displayed fine.
But:
* I mark a column and the standard sort button of CL_SALV_TABLE, the row order changes
* I press a custom button
* In the eventhandler method for added_function, the table (the ALV is based on) has NOT been sorted
* After coming back to the ALV, the list is UNsorted again, but the column shows the red indicator for "sorted by this column"
(the ALV seems to be thinking, that the table has been sorted, but it isn't)
The problem is, that I don't know which row the user has marked. If he marks the third row after sorting the grid, the read table ... index ... finds the row, which was the third BEFORE sorting (which is another row). The displayed ALV has another order than the itab, the third row in ALV is NOT the third row in the itab, the ALV is based on.
I've tried anything:
* GET_GLOBALS_FROM_SLVC_FULLSCR with check_changed_data
* refresh( refresh_mode = if_salv_c_refresh=>full )
* get_metadata( )
Nothing helped
example:
A B C
200 100 200
100 200 100
300 300 300
A shows the ALV after method 'display', B shows the sorted ALV list, C shows the itab. Of course, the user only can see B and want to mark the second row ('200'). In the event handler method for added_function I can see, that the second row has been marked - but based on the unsorted list (which means, I operate with '100' instead of '200')
What can I do?
‎2015 Sep 07 10:53 PM
Hallo Ralf,
as you mentioned, B is sorted table, when sort the table, the backend and the frontend will be changed, so in this metod, we have changing paramter, because the table will be changed.
if you have ITAB, lt_ITAB,
you can assign the global table to you ITAB,
lt_ITAB = gt_conn.
then you will get the sorted table ( B )
.
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = r_alv_table
CHANGING
t_table = gt_conn.
Try this demo
SALV_DEMO_TABLE_SELECTIONS
Regards
Ibr
‎2015 Sep 08 3:27 AM
Hi,
Make sure that you do not recreate the cl_salv_table on each PBO.
in SALV_DEMO_TABLE_SELECTIONS you can see that all the code is
conditioned by if gr_container is not bound.
Regards.
‎2015 Sep 08 5:53 AM
‎2015 Sep 08 5:54 AM
I do not have a local itab. There is just one itab and this is global.
Edit: I was wrong. I used a sorted itab in the whole program and copied it into a standard itab (because SALV does not work with sorted itabs). I always looked into the sorted itab (and of course, a sorted itab can not be sorted).
Message was edited by: Ralf Wenzel for providing the solution
‎2015 Sep 08 6:03 AM
Hi,
SALV_DEMO_TABLE_SELECTIONS have also form display_fullscreen .
Check it out .
Regards.
‎2015 Sep 08 6:59 AM
Hi Ralf,
could you assign this table to a ref data.
data lr_data_Tab type ref to data.
FIELD-SYMBOLS:
<lt_data> TYPE STANDARD TABLE,
<ls_data> TYPE ANY.
GET REFERENCE OF ITAB INTO lr_data_tab.
ASSIGN lr_data_tab->* TO <lt_data>.
Ps: I have tried in my test program but I can not get you problem, I get them with same index, before sorting and after sorting
Regards
Ibrahim
‎2015 Sep 08 7:12 AM
The index was the same, but at that index, in the sorted (displayed) table contents another row than the unsorted table in memory.
But I posted the solution, I had two itabs.