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

problem in function module for expand in tree display

Former Member
0 Likes
677

hi all,

i have found a function module which can expand all nodes of the tree.

it is TREEV_EXPAND_ROOT_NODES.

CALL FUNCTION 'TREEV_EXPAND_ROOT_NODES' "Expands all Root Nodes

EXPORTING

handle = " cntl_handle Handle for Tree Control

level_count = " i Number of Levels to be Expanded

expand_all_children = " c

  • no_flush = " c

EXCEPTIONS

FAILED = 1 " General Error

ILLEGAL_LEVEL_COUNT = 2 . " LEVEL_COUNT Must Be GE 0

for above function call what value should i give for "handle parameter".

thanks.

3 REPLIES 3
Read only

Former Member
0 Likes
557

Hi,

Please pass the value as below with minor changes as per your requirement.

DATA: tree TYPE cntl_handle,

DATA: TREE_HANDLE TYPE CNTL_HANDLE.

data: local_rep like sy-repid,

local_scr like sy-dynnr.

constants: dynpro_default type i value -1.

data: node_table type node_table_type,

constants : TREEV_NODE_SEL_MODE_SINGLE TYPE I VALUE 0,

call function 'TREEV_CREATE_SIMPLE_TREE'

exporting

owner_repid = local_rep

dynnr = local_scr

left = 0

top = 0

width = 45

height = 22

no_flush = space

shellstyle = style

parentid = dynpro_default

node_selection_mode = treev_node_sel_mode_single

node_table_structure_name = 'MTREESNODE'

tables

node_table = node_table

changing

handle = tree_handle

exceptions

create_error = 1

tree_control_not_existing = 2

cntl_system_error = 3

failed = 4

illegal_node_selection_mode = 5

missing_node_structure_name = 6

error_in_node_table = 7

dp_error = 8

illegal_owner_repid = 9

table_structure_name_not_found = 10

others = 11.

if sy-subrc <> 0.

message e645 with text-745 sy-subrc.

endif.

call function 'TREEV_EXPAND_ROOT_NODES'

exporting

handle = tree_handle

level_count = 2

expand_all_children = 'X'

no_flush = ' '

exceptions

failed = 1

illegal_level_count = 2

cntl_system_error = 3

others = 4.

if sy-subrc <> 0.

message e645 with text-743 sy-subrc.

endif.

If it is helpfull means reward me with some points.

Regards

Chitra

Read only

Former Member
0 Likes
557

Hi,

Please pass the value as below with minor changes as per your requirement.

DATA: tree TYPE cntl_handle,

DATA: TREE_HANDLE TYPE CNTL_HANDLE.

data: local_rep like sy-repid,

local_scr like sy-dynnr.

constants: dynpro_default type i value -1.

data: node_table type node_table_type,

constants : TREEV_NODE_SEL_MODE_SINGLE TYPE I VALUE 0,

call function 'TREEV_CREATE_SIMPLE_TREE'

exporting

owner_repid = local_rep

dynnr = local_scr

left = 0

top = 0

width = 45

height = 22

no_flush = space

shellstyle = style

parentid = dynpro_default

node_selection_mode = treev_node_sel_mode_single

node_table_structure_name = 'MTREESNODE'

tables

node_table = node_table

changing

handle = tree_handle

exceptions

create_error = 1

tree_control_not_existing = 2

cntl_system_error = 3

failed = 4

illegal_node_selection_mode = 5

missing_node_structure_name = 6

error_in_node_table = 7

dp_error = 8

illegal_owner_repid = 9

table_structure_name_not_found = 10

others = 11.

if sy-subrc <> 0.

message e645 with text-745 sy-subrc.

endif.

call function 'TREEV_EXPAND_ROOT_NODES'

exporting

handle = tree_handle

level_count = 2

expand_all_children = 'X'

no_flush = ' '

exceptions

failed = 1

illegal_level_count = 2

cntl_system_error = 3

others = 4.

if sy-subrc <> 0.

message e645 with text-743 sy-subrc.

endif.

If it is helpfull means reward me with some points.

Regards

Chitra

Read only

0 Likes
557

hi chitra,

actually i have created tree display using class cl_gui_simple_tree.

i have used program sapsimple_tree_control_demo.

hence need to expand all nodes of tree.

how should i do this.