cancel
Showing results for 
Search instead for 
Did you mean: 

How to keep selection (or select) the row of SORTED ALV table?

0 Kudos

Dear Experts,

I have WD ALV table with grouped and therefore sorted layout. I know that sorted ALV beahve differently.

The problem is that if the values in cell is updated (setting attribute of selected element of context node bound to the ALV table), then the whole table is redrawn and selection disappears. It does not happen when layout of ALV is not sorted/grouped.

I need somehow to select the ALV line again. Method MOV_To of IF_WD_CONTEXT_NODE for some reason is not working in sorted ALV (it selects element on node but not in ALV table). And in ALV Interface controller I also could not find anything usefull.

Thanks.

Best regards,

Dmitry.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Hi, I solved keeping the row selection by adding an extra column just to hold information that such row is understood as selected.

I have written a blog post (including source code) because I've faced similar problem: ABAP - ALV Context menu + keep row selection after a filter is applied

So if you find it useful, please feel free to re-use it

Former Member
0 Kudos

Hi,

Are you not able to select any row in ALV after sorting

Regards,

Lekha.

0 Kudos

Dear Lekha,

sorry - I was not clear. I can select manually, but I wanted selection to stay, or select again programmatically.

Otherwise user do not see which line was selected. The problem is that if values in the ALV are updated (by updating context node) then ALV table is refreshed (resorted again) and selection is lost. I would like to select it again programmatically because I know which line was selected.

Regards,

Former Member
0 Kudos

Hi,

In the View where you ALV is placed, go to methods tab and try to implement the ON_STD_FUNCTION_AFTER and ON_STD_FUNCTION_BEFORE.

Please check wether these are getting triggered before and after sort.

If yes, then get the lead selection index/lead selection element in the BEFORE event and try to set it to the node in the AFTER event.

If the above ones are not triggering try to check for other ALV event handlers that gets triggered to solve your issue.

Regards,

Lekha.

Former Member
0 Kudos

Hallo Dmitry,

See the sap note :1445428

[https://service.sap.com/sap/support/notes/1445428|https://service.sap.com/sap/support/notes/1445428]

Follow this thread which suggest a work around.

[|]