cancel
Showing results for 
Search instead for 
Did you mean: 

Error "Lead selection not set for context node" on TREE

Former Member
0 Kudos

Hi,

I create an TREE element inside a web dynpro.

When i test the application the first time i select the tree item it's ok but on the second time if i am on the same item i have the error "Lead selection not set for context node".

Anyone have this error?

Thank you in advance.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Yes..

I have encountered...if you press 2 times in the same tree node...

I think, maybe you set the lead selection for your tree,using the following coding, right?


treeNode->set_lead_selection(context_element).

"or you get the index from the parameter "WDEvent", and then use the set_lead_selection_index( )....

However, you can debug your coding, you can find that,lead selection is already set.

So, i suggest you make use the following EXAMPLE coding to set your lead selection of tree, USing the parameter "Path" of "WDEvent"


data:
      lt_string type TABLE OF string,
      lo_string type string.
* get the string of path
  SPLIT i_path at '.' into TABLE lt_string.

  data:
    is_node type wdy_boolean,
    nodepath type string,
    node type REF TO if_wd_context_node,
    inde type i.

  is_node = abap_true.
  loop at lt_string into lo_string.
* form the Node-path
    IF nodepath is initial.
      nodepath = lo_string.
    ELSE.
      CONCATENATE nodepath lo_string into nodepath SEPARATED BY '.'.
    ENDIF.

* set lead selection of every node in the Path
    if is_node = abap_true.
      node = wd_context->path_get_node( nodepath ).
      is_node = abap_false.
    else.
      CALL FUNCTION 'CONVERT_STRING_TO_INTEGER'
          EXPORTING      P_STRING        = lo_string
          IMPORTING      P_int        = inde.
      node->set_lead_selection_index( inde ).
      is_node = abap_true.
    endif.

  ENDLOOP.

Hope it can help you a little..

Best wishes.