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

add_node method

Former Member
0 Likes
699

Hi Expert!!

I need you help i am creating column tree with using my local class with reference to cl_gui_column_tree the method add_node is not in this class .As this method is present in cl_column_tree_model class.Please advice which method i can use as similarly add_node in cl_gui_column_tree.

Thanks in advance.

Ankur Garg

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
597

Hi Ankur,

Add_method is not present in cl_gui_column_tree you can use cl_column_tree_model for add_method method.

Please reward if helpfull.

Amit.

2 REPLIES 2
Read only

uwe_schieferstein
Active Contributor
0 Likes
597

Hello Ankur

Sample report SAPCOLUMN_TREE_CONTROL_DEMO shows how to build a tree using class cl_gui_column_tree.

Below you see part of the coding where the tree nodes are created:


...
* add some nodes to the tree control
* NOTE: the tree control does not store data at the backend. If an
* application wants to access tree data later, it must store the
* tree data itself.

  PERFORM BUILD_NODE_AND_ITEM_TABLE USING NODE_TABLE ITEM_TABLE.

  CALL METHOD G_TREE->ADD_NODES_AND_ITEMS
    EXPORTING
      NODE_TABLE = NODE_TABLE
      ITEM_TABLE = ITEM_TABLE
      ITEM_TABLE_STRUCTURE_NAME = 'MTREEITM'
    EXCEPTIONS
      FAILED = 1
      CNTL_SYSTEM_ERROR = 3
      ERROR_IN_TABLES = 4
      DP_ERROR = 5
      TABLE_STRUCTURE_NAME_NOT_FOUND = 6.
  IF SY-SUBRC <> 0.
    MESSAGE A000.
  ENDIF.

* expand the node with key 'Root'
  CALL METHOD G_TREE->EXPAND_NODE
    EXPORTING
      node_key            = c_nodekey-Root
    EXCEPTIONS
      FAILED              = 1
      ILLEGAL_LEVEL_COUNT = 2
      CNTL_SYSTEM_ERROR   = 3
      NODE_NOT_FOUND      = 4
      CANNOT_EXPAND_LEAF  = 5.
  IF SY-SUBRC <> 0.
    MESSAGE A000.
  ENDIF.


ENDFORM.                    " CREATE_AND_INIT_TREE

It seems that this class does not have a method for adding a single node. Thus, use method ADD_NODES_AND_ITEMS with a single entry in the node and item itabs.

Regards

Uwe

Read only

Former Member
0 Likes
598

Hi Ankur,

Add_method is not present in cl_gui_column_tree you can use cl_column_tree_model for add_method method.

Please reward if helpfull.

Amit.