2009 Feb 03 8:28 AM
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
2009 Feb 03 8:41 AM
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
2009 Feb 03 8:32 AM
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
2009 Feb 03 8:36 AM
Hi Aakash Banga,
There are no corresponding code for Expand or collapse all the Node .
Please help me .
Thanks
Tarak
2009 Feb 03 8:39 AM
2009 Feb 03 9:01 AM
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
2009 Feb 03 8:32 AM
hello,
please try this Function module it may help u...i am not sure RS_TREE_LIST_DISPLAY
Thank u,
santhosh
2009 Feb 03 8:41 AM
Try this:
CALL METHOD CL_GUI_COLUMN_TREE=>expand_nodes
or
CALL METHOD CL_GUI_COLUMN_TREE=>expand_root_nodes
2009 Feb 03 8:48 AM
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.
2009 Feb 03 9:11 AM
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