title: ABAP: Event CONTEXT_MENU_SELECT of CL_SIMPLE_TREE_MODEL - can't fire it
body: <p>I have an instance of <code>CL_SIMPLE_TREE_MODEL</code>, I managed to trigger and handle the <code>CONTEXT_MENU_REQUEST</code> event, and I build my context menu.</p>
  
  <p>I added my functions the way I wanted.</p>
  
  <p>Problem is, when I select one of the options from my context menu, nothing happens. In other words, the program flow doesn't go inside the handler for <code>CONTEXT_MENU_SELECT</code>.</p>
  
  <p>I'm of course assuming this event is fired when I click on a function in the context menu.</p>
  
  <p>I found official documentation, but only for the "default context menu" that you access with Shift+F10, that needs certain subroutines in the program in order to fire.</p>
  
  <p>What I did:</p>
  
  <ol>
  <li>I did define and implement a method that is a handler for that event.</li>
  <li>I did set the handler for the event at the same place I set the handler for the <code>CONTEXT_MENU_REQUEST</code> event</li>
  <li>I did NOT register the event with the <code>SET_REGISTERED_EVENTS</code> because there is NO ID defined in the class attributes for that event - such as there was for the <code>CONTEXT_MENU_REQUEST</code> event.</li>
  </ol>
  
  <p>The code:</p>
  
  <pre><code>REPORT.
  
  CLASS lcl_tree_handler DEFINITION.
  
    PUBLIC SECTION.
      METHODS:
        pbo,
        on_ctx_menu_request FOR EVENT node_context_menu_request OF cl_simple_tree_model
          IMPORTING node_key menu sender, "TYPE TM_NODEKEY CL_CTMENU
        on_ctx_menu_select FOR EVENT node_context_menu_select OF cl_simple_tree_model
          IMPORTING node_key fcode. "TYPE TM_NODEKEY SY-UCOMM
      DATA:
        po_tree_model TYPE REF TO cl_simple_tree_model,
        gt_tree       TYPE TABLE OF treemsnodt,
        control       TYPE REF TO cl_gui_control.
  ENDCLASS.
  
  CLASS lcl_tree_handler IMPLEMENTATION.
  
    METHOD pbo.
      DATA: lt_events TYPE cntl_simple_events,
            ls_event  TYPE cntl_simple_event.
      FIELD-SYMBOLS &lt;gs_tree&gt; TYPE treemsnodt.
  
      CHECK po_tree_model IS NOT BOUND.
  
      CREATE OBJECT po_tree_model
        EXPORTING
          node_selection_mode = po_tree_model-&gt;node_sel_mode_single.
  
      APPEND INITIAL LINE TO gt_tree ASSIGNING &lt;gs_tree&gt;.
      &lt;gs_tree&gt;-node_key = 'Node key 1'.
      &lt;gs_tree&gt;-text = 'First node'.
      &lt;gs_tree&gt;-isfolder = 'X'.
      APPEND INITIAL LINE TO gt_tree ASSIGNING &lt;gs_tree&gt;.
      &lt;gs_tree&gt;-node_key = 'Node key 2'.
      &lt;gs_tree&gt;-relatkey = 'Node key 1'.
      &lt;gs_tree&gt;-relatship = cl_tree_model=&gt;relat_last_child.
      &lt;gs_tree&gt;-text = 'First child'.
      po_tree_model-&gt;add_nodes(
            node_table = gt_tree ).
  
      ls_event-eventid = cl_simple_tree_model=&gt;eventid_node_context_menu_req.
      ls_event-appl_event = 'X'.              "tried with space too
      APPEND ls_event TO lt_events.
  
      CALL METHOD po_tree_model-&gt;set_registered_events
        EXPORTING
          events = lt_events.
  
      SET HANDLER on_ctx_menu_request FOR po_tree_model.
      SET HANDLER on_ctx_menu_select FOR po_tree_model.
  
      po_tree_model-&gt;create_tree_control(
        EXPORTING
          parent = cl_gui_container=&gt;screen0
        IMPORTING
          control = control ).
  
    ENDMETHOD.
  
    METHOD on_ctx_menu_request.                 "I initialize the context menu object here.
      DATA: lt_chidren_keys TYPE treemnotab,
            ls_child_key    TYPE tm_nodekey,
            lv_text         TYPE gui_text.
  
      CALL METHOD sender-&gt;node_get_children
        EXPORTING
          node_key       = node_key
        IMPORTING
          node_key_table = lt_chidren_keys
        EXCEPTIONS
          OTHERS         = 2.
  
      LOOP AT lt_chidren_keys INTO ls_child_key.
        lv_text = ls_child_key.
        CALL METHOD menu-&gt;add_function
          EXPORTING
            fcode = 'ONE'
            text  = lv_text
            ftype = 'B'.
      ENDLOOP.
  
      menu-&gt;add_separator( ).
      CALL METHOD menu-&gt;add_function
        EXPORTING
          fcode = 'ALL'
          text  = 'All the work groups'
          ftype = 'W'.
  
    ENDMETHOD.
  
    METHOD on_ctx_menu_select.
      BREAK-POINT.                 "tried actual code here too.
    ENDMETHOD.
  
  ENDCLASS.
  
  
  DATA: go_tree_handler TYPE REF TO lcl_tree_handler.
  
  PARAMETERS dummy.
  
  INITIALIZATION.
    CREATE OBJECT go_tree_handler.
  
  AT SELECTION-SCREEN OUTPUT.
    go_tree_handler-&gt;pbo( ).
  
  AT SELECTION-SCREEN ON EXIT-COMMAND.
    go_tree_handler-&gt;control-&gt;free( ).
  </code></pre>
  
  <p>The tree is displayed, on right click the context menu appears.</p>
  
  <p>But nothing fires when I chose a menu item. Am I missing something ?</p>