cancel
Showing results for 
Search instead for 
Did you mean: 

Error "Lead selection not set for context node"

ged_hurst
Participant
0 Kudos

Hi everyone,

I've got a Tree control in WebDynpro ABAP and I've implemented an "expand all" button.

Here's the coding:


METHOD expand_node_rec.
  DATA lo_el_child TYPE REF TO if_wd_context_element.
  DATA lo_node_children TYPE  wdr_context_child_map.
  DATA wa_lo_node_children LIKE LINE OF lo_node_children.
  DATA lo_nd_child TYPE REF TO if_wd_context_node.
  DATA lo_kschl TYPE klschl.
  DATA lv_has_children TYPE boolean.

  lo_el_child = node->get_element( ).
  lo_node_children = node->get_child_nodes( ).
  node->get_attribute( EXPORTING name = 'KSCHL' IMPORTING value = lo_kschl ).
  node->get_attribute( EXPORTING name = 'HAS_CHILDREN' IMPORTING value = lv_has_children ).
  IF lv_has_children = abap_true.
    node->set_attribute( name = 'IS_EXPANDED' value = abap_true ).
  ENDIF.

  LOOP AT lo_node_children INTO wa_lo_node_children.
    lo_nd_child = wa_lo_node_children-node.
    me->expand_node_rec( node = lo_nd_child  ).
  ENDLOOP.

ENDMETHOD.

However I'm getting the error above: "Lead selection not set for context node".

Any suggestions?

Edited by: DEVELOPMENT THEMIS on Jul 7, 2011 6:34 PM

Accepted Solutions (1)

Accepted Solutions (1)

former_member199125
Active Contributor
0 Kudos

Hi...

lo_el_child = node->get_element( ). will return leadselection element. If you didn't check "initialize lead selection property" for child node, then you may get the error. So check once whether did you check the initialize lead selction property.

Regards

Srinivas

Answers (2)

Answers (2)

simadri_sekhar
Participant
0 Kudos

hi developement Themis,

I think u didn't diclare "node" as context node. So declare it as a context node before using as a context node..as below

DATA node TYPE REF TO if_wd_context_node.

or u can use "lo_nd_child " as ur context node in ur program in place of "node"

then I think this error will be removed.

thanks,

simadri

Former Member
0 Kudos

I assume you are getting the error on "lo_el_child = node->get_element( )."?

Have you set the context node to initialize lead selection?