cancel
Showing results for 
Search instead for 
Did you mean: 

Lead selection not set - Error when sorting ALV table

former_member94854
Participant
0 Kudos

Hi there,

I've integrated an ALV control and now I'm facing the following problem:

When I use the ALVs sort function, the exception "lead selection not set" occurs. I mapped my context node TEST to the interface node DATA of the ALV component usage. And when I execute the sort function and try to read the lead selection information, I debugged that the lead selection information is lost. That happens when the mappee of the node TEST is retrieved by the context nodes Method get_attribute. An initialization does not take place, although the context node attribute "initialize lead selection" is set to true. Is that a common problem or do I handle the alv control in a wrong way?

Kind regards,

Albert

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

>

> Hi there,

>

> I've integrated an ALV control and now I'm facing the following problem:

>

> When I use the ALVs sort function, the exception "lead selection not set" occurs. I mapped my context node TEST to the interface node DATA of the ALV component usage. And when I execute the sort function and try to read the lead selection information, I debugged that the lead selection information is lost. That happens when the mappee of the node TEST is retrieved by the context nodes Method get_attribute. An initialization does not take place, although the context node attribute "initialize lead selection" is set to true. Is that a common problem or do I handle the alv control in a wrong way?

>

> Kind regards,

> Albert

Have you done any coding in WDDOMIDIFYVIEW method of the view in which you are writing the node TEST. If yes then lead selection will not work. the reason is stated earlier in Uday's note.

Remove the code from WDDOMODIFYVIEW method and implement it in some other way.

I have specified this in the thread which is also specified by Uday

Regards,

Feroz

uday_gubbala2
Active Contributor
0 Kudos

Hi Albert,

This is a known limitation of the Web Dynpro ALV which arises during sorting of your ALV. Please go through Thomas Jung's comments in this [thread|;.

Regards,

Uday

Am pasting the same in here for your observation:

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:

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

u25CF 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 Member
0 Kudos

Hi there,

I was facing exactly the same issue.

It can be solved bay initializing the lead-selection with an Index:

  • get element via lead selection

lo_el_resultats = lo_nd_resultats->get_element( ).

  • @TODO handle not set lead selection

IF lo_el_resultats IS INITIAL.

  • alternative access via index

lo_el_resultats = lo_nd_resultats->get_element( index = 1 ).

ENDIF.

BR,

Mickaë