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

ALV TREE

Former Member
0 Likes
2,051

Hi All,

I am working on ALV Tree (CL_GUI_COLUMN_TREE). i have two pushbotton in tree output to expand/collapse the tree. Can anyone help me to Develop a code to Expand all the node when i click on Expand Button or collapse all the node when click on Collapse Button.

Thanks a lot in advance.

Regards,

Tarak

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,736

Try this:

CALL METHOD CL_GUI_COLUMN_TREE=>expand_nodes

or

CALL METHOD CL_GUI_COLUMN_TREE=>expand_root_nodes

Hi All,

I am working on ALV Tree (CL_GUI_COLUMN_TREE). i have two pushbotton in tree output to expand/collapse the tree. Can anyone help me to Develop a code to Expand all the node when i click on Expand Button or collapse all the node when click on Collapse Button.

Thanks a lot in advance.

Regards,

Tarak

8 REPLIES 8
Read only

Former Member
0 Likes
1,736

hi

jus look at this prog BCALV_TREE_SIMPLE_DEMO and BCALV_TREE_DEMO .

go to SE38 and give BCALV*.you'll get a list of all demo progs.

hope this helps

regards

Aakash Banga

Read only

0 Likes
1,736

Hi Aakash Banga,

There are no corresponding code for Expand or collapse all the Node .

Please help me .

Thanks

Tarak

Read only

0 Likes
1,736

Hi,

Check this demo program BCALV_TREE_MOVE_NODE_TEST

Read only

0 Likes
1,736

Hi,

Use the method suggested by richard expand_root_nodes.

Anyhow to work this when clicked on expand button you need to handle event EXPAND_NO_CHILDREN. Inside the handler write the above method. Each time user opens a folder (with attribute EXPANDER = 'X') all the others will be expanded.

Is that what you requirement?

Regards

Marcin

Read only

Former Member
0 Likes
1,736

hello,

please try this Function module it may help u...i am not sure RS_TREE_LIST_DISPLAY

Thank u,

santhosh

Read only

Former Member
0 Likes
1,737

Try this:

CALL METHOD CL_GUI_COLUMN_TREE=>expand_nodes

or

CALL METHOD CL_GUI_COLUMN_TREE=>expand_root_nodes

Read only

former_member203501
Active Contributor
0 Likes
1,736

hi the same thing is used in all the programs...see below

BCALV_TEST_COLUMN_TREE

BCALV_TEST_SIMPLE_TREE

BCALV_TREE_01

BCALV_TREE_02

BCALV_TREE_03

BCALV_TREE_04

BCALV_TREE_05

BCALV_TREE_06

BCALV_TREE_DEMO

like this ..

create object gr_container

exporting container_name = 'TREE_CONTAINER'.

data: l_hierarchy_header type treev_hhdr,

l_width type i value 50.

l_hierarchy_header-heading = 'HEADER'.

l_hierarchy_header-width = l_width.

create object gr_tree

exporting

parent = gr_container

node_selection_mode =

cl_gui_column_tree=>node_sel_mode_multiple

item_selection = 'X'

hierarchy_column_name = 'COLUMN'

hierarchy_header = l_hierarchy_header.

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,736

Class [CL_GUI_COLUMN_TREE|https://www.sdn.sap.com/irj/scn/advancedsearch?query=cl_gui_column_tree&cat=sdn_all] inherit methods of class [CL_TREE_CONTROL_BASE|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=cl_tree_control_base&adv=false&sortby=cm_rnd_rankvalue], so just use the method [expand_root_nodes|https://www.sdn.sap.com/irj/scn/advancedsearch?cat=sdn_all&query=expand_root_nodes&adv=false&sortby=cm_rnd_rankvalue]

CALL METHOD tree->expand_root_nodes
  EXPORTING  level_count = level_count
             expand_subtree = expand_subtree
  EXCEPTIONS failed = 1
             illegal_level_count = 2
             cntl_system_error = 3.

Where level_count :

- 0: Only the root nodes are expanded - no underlying nodes.

- 1: The current node and the next hierarchy level are expanded.

and expand_subtree

- 'X': Expands all nodes in the subtree. The system ignores any value of LEVEL_COUNT

To collapse all nodes use method [COLLAPSE_ALL_NODES|https://www.sdn.sap.com/irj/scn/advancedsearch?query=collapse_all_nodes&cat=sdn_all]

Look at [SAP Tree and Tree Model (BC-CI)|http://help.sap.com/printdocu/core/Print46c/en/data/pdf/BCCITREE/BCCITREE.pdf] or [SAP Tree Model|http://help.sap.com/erp2005_ehp_04/helpdata/EN/4a/0f753824a34f47e10000009b38f8cf/frameset.htm] for documentation and read SAP demo programs like SAPCOLUMN_TREE_CONTROL_DEMO, SAPSIMPLE_TREE_CONTROL_DEMO, and

SAPTLIST_TREE_CONTROL_DEMO, BCALV_TREE_SIMPLE_DEMO and BCALV_TREE_DEMO

Regards