Lead Selection lost after wd alv table is sorted
I have three togglebuttons for selecting different data sources into my wd_salv table. The datasource from the context is set to initalize lead selection. when the wd_salv table is first displayed the lead selection is indeed set.
Choosing a different togglebutton changes the selection of data in the wd_salv table through the defined supply function and the lead selection is set.
when a sort is applied to the wd_salv table the lead selection is lost. I can get around this by reading the context and setting the lead selection myself in the event handler ON_STD_FUNCTION_AFTE.
Now choosing a different togglebutton when the sort is already applied, the lead selection is lost. This time the ON_STD_FUNCTION_AFTE event handler is not called and neither is any other of the salv event handlers as far as I can tell (I checked them all).
The lack of lead selection is a factor when I have another table which relies on the lead selection in my wd_salv table, because no lead selection = shortdump.
you can see this lack of lead selection if you run salv_wd_test_simple1 and sort one of the columns.
If anyone knows how to ensure the lead selection is maintained on/after a sort is applied please could they help. Also why is this not happening by default after my context node is set to initialization lead selection?
Sravan Varagani replied
Do the capturing of the index or the reference to the element in ON_LEAD_SELECT event of that perticular ALV.
Hope the selection property of the ALV is 0:1, if yes, then when user selects a record in the ALV table
ON_LEAD_SELECT standard event is triggered. In the event handler of this, read the lead selected element and set it to a temporary variable.
Set the lead selection back in WDDOMODIFY of the view. This would also eliminate any changes to the context node in the same hook method.