<p>I am displaying a list of items using a SAP ABAP column tree model, basically a tree of folder and files, with columns.</p>
<p>I want to load the sub-nodes of folders dynamically, so I'm using the EXPAND_NO_CHILDREN event which is firing correctly.</p>
<p>Unfortunately, after I add the new nodes and items to the tree, the folder is automatically collapsing again, requiring a second click to view the sub-nodes.
Do I need to call a method when handling the event so that the folder stays open, or am I doing something else wrong?</p>
<pre><code>* Set up event handling.
  LS_EVENT-EVENTID  = CL_ITEM_TREE_CONTROL=&gt;EVENTID_EXPAND_NO_CHILDREN.
  LS_EVENT-APPL_EVENT = GC_X.
  APPEND LS_EVENT TO LT_EVENTS.
  CALL METHOD GO_MODEL-&gt;SET_REGISTERED_EVENTS
    EXPORTING
      EVENTS                    = LT_EVENTS
    EXCEPTIONS
      ILLEGAL_EVENT_COMBINATION = 1
      UNKNOWN_EVENT             = 2.
  SET HANDLER GO_APPLICATION-&gt;HANDLE_EXPAND_NO_CHILDREN
    FOR GO_MODEL.

...


* Add new data to tree.
  CALL METHOD GO_MODEL-&gt;ADD_NODES
    EXPORTING
      NODE_TABLE = PTI_NODES[]
    EXCEPTIONS
      ERROR_IN_NODE_TABLE = 1.

  CALL METHOD GO_MODEL-&gt;ADD_ITEMS
    EXPORTING
      ITEM_TABLE = PTI_ITEMS[]
    EXCEPTIONS
      NODE_NOT_FOUND = 1
      ERROR_IN_ITEM_TABLE = 2.
</code></pre>

[{'answer_id': 14159, 'author': 'Pat Hermens', 'author_id': 1677, 'author_profile': 'https://Stackoverflow.com/users/1677', 'pm_score': 2, 'selected': False, 'text': '<p>It\'s been a while since I\'ve played with SAP, but I always found the SAP Library to be particularly helpful when I got stuck...</p>\n\n<p>I managed to come up with this one for you:\n<a href="http://help.sap.com/saphelp_nw04/helpdata/en/47/aa7a18c80a11d3a6f90000e83dd863/frameset.htm" rel="nofollow noreferrer">http://help.sap.com/saphelp_nw04/helpdata/en/47/aa7a18c80a11d3a6f90000e83dd863/frameset.htm</a>, specifically: </p>\n\n<blockquote>\n  <p><em>When you add new nodes to the tree model, set the flag ITEMSINCOM to \'X\'.<br />\n  This informs the tree model that you want to load the items for that node on demand.</em></p>\n</blockquote>\n\n<p>Hope it helps?</p>\n'}, {'answer_id': 63251, 'author': 'tomdemuyt', 'author_id': 7602, 'author_profile': 'https://Stackoverflow.com/users/7602', 'pm_score': 0, 'selected': False, 'text': '<p>Your code looks fine,</p>\n\n<p>I would use the method <code>ADD_NODES_AND_ITEMS</code> myself if I were to add nodes and items ;)</p>\n\n<p>Beyond that, try to call <code>EXPAND_NODE</code> after you added the items/nodes and see if that helps.</p>\n'}]
['https://Stackoverflow.com/questions/7558', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/-1/']