cancel
Showing results for 
Search instead for 
Did you mean: 

Selected row not being selected when ALV table sorted

former_member82844
Participant
0 Kudos

This one has me baffled.... I have an ALV table with rows that can be selected and some that cannot. I then select a row and everything is fine... the row is highlighted, the lead selection is set, life is good.

Now I sort one of the columns in the table using the sort option on the column header. When I click on a row selection, the lead selection event is triggered, the lead index is set but by time it returns to the screen the lead index is lost and the row is not selected (highlighted).

I have double checked my code and nowhere do I manually set the lead index (or clear it)..... I have tried setting the set_selected method and that does not work.... Also I have tried to set Lead selection index and still the row is not selected.....

Any ideas?

Glenn

Accepted Solutions (0)

Answers (1)

Answers (1)

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

This is a known limitation of the Web Dynpro ALV when sorting. Here is the explanation from the online help:

Important Exception: Sorting

Here ALV has to use the entire dataset so that the data records can be arranged in the new order. For this purpose, the ALV component temporarily takes control of the internal data table and invalidates the corresponding context node of your application during this time. This ensures that the application cannot access the context node while the ALV component is editing the internal data table.

Once the internal data table has been resorted, ALV rebuilds the context node, releases it again for the application, and displays the data accordingly.

This ensures that the internal data table is never copied. This is important because large volumes of data would considerably impact performance and memory space.

When you are planning your application, note the following side-effects of this mechanism:

● When the context node is invalidated, information about current selections, and in particular the lead selection, is lost.

● If your application has created subnodes for the context node, (master-detail scenario), these subnodes are lost as soon as the ALV component invalidates the context node. If the application then tries to access the subnodes, a runtime error occurs.

former_member82844
Participant
0 Kudos

That is ugly..... But it answers the problem... Thanks

Former Member
0 Kudos

Hi,

I also faced the same issue but got the solution.

I had used the node which is mapped with ALV data node in the WDDOMODIFYVIEW of the View.

Note that I had not invalidated the node in WDDOMODIFYVIEW but set one of the attributes using the element.

When I commented the code..The problem resolved.

The Conclusion which I got was: we should not work with node(which is mapped with ALV data node) in WDDOMODIFYVIEW in order to be able to select a row

Thanks,

Feroz

Former Member
0 Kudos

Hi, Thomas Jung!

I'd like your opinion on the problem below:

1) Sort column of ALV.

2) Select a row.

3) Change the value of an attribute of the selected row.

After changing the attribute value, the lead selection is canceled. Can I set  the lead selection again? Can you tell me if there was an upgrade in the sort exception?

Thanks,

Rodrigo Franco