Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Expand a node on a tree after a drop

Former Member
0 Likes
370

Hi,

after a node has been added to a tree (reagged from another tree) how can i expand the node that the new node has been added to.

I have tried CALL METHOD users_tree->expand_node

EXPORTING

node_key = node-relatkey.

But this is not working, i wonder where this has to be called at what point i mean?

Hi,

after a node has been added to a tree (reagged from another tree) how can i expand the node that the new node has been added to.

I have tried CALL METHOD users_tree->expand_node

EXPORTING

node_key = node-relatkey.

But this is not working, i wonder where this has to be called at what point i mean?

1 REPLY 1
Read only

uwe_schieferstein
Active Contributor
0 Likes
339

Hello Kieran

Please copy the sample report <b>SAPSIMPLE_TREE_DRAG_DROP_DEMO</b> (transaction SE83, folder <i>Controls -> Trees</i>) and make the following changes in the event handler method <b>HANDLE_RIGHT_TREE_DROP</b>:

  METHOD handle_right_tree_drop.
    DATA: LOCAL_NODE_TABLE TYPE NODE_TABLE_TYPE,
          new_NODE TYPE MTREESNODE,
          dataobj type ref to lcl_dragdropdataobject.

     " get information about the dragged object:
     " the data object

...


     CALL METHOD g_right_tree->expand_node
       EXPORTING
         node_key            = node_key
*         LEVEL_COUNT         =
*         EXPAND_SUBTREE      =
       EXCEPTIONS
         FAILED              = 1
         ILLEGAL_LEVEL_COUNT = 2
         CNTL_SYSTEM_ERROR   = 3
         NODE_NOT_FOUND      = 4
         CANNOT_EXPAND_LEAF  = 5
         others              = 6
             .
     IF sy-subrc <> 0.
*      MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*                 WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
     ENDIF.

  ENDMETHOD.

Now run the report and close the folder of the right tree. <i>Drag&drop</i> a node from the left to the right tree and the folder in the right tree will be expanded.

Regards

Uwe