Application Development 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: 

cl_gui_simple_tree proplem, who can help.

Former Member
0 Kudos
128

no result came out. what is the proplem?

REPORT ZALEXTEST.

data:ok_code type sy-ucomm,

save_ok type sy-ucomm.

data: wa_container type scrfname value 'TREE',"给容器定义一个名字,和屏幕中创建的容器同名,用来关联屏幕中的容器

wa_custom_container type ref to cl_gui_custom_container,"定义一个容器对象的引用

wa_tree type ref to cl_gui_simple_tree."定义一个tree对象的引用

data:node_table like table of mtreesnode."定义节点表,所有树节点都存放在这表中,mtreesnode是一个节点structure

data:node1 type mtreesnode."定义节点表的工作区

start-of-selection.

call screen 100.

*loop at node_table into node1.

*write:/ node1-node_key.

*endloop.

module status_0100 output.

*write:/ 'hahah'.

set pf-status 'STATUS1'.

if wa_custom_container is initial.

perform create_tree."调用创建树对象方法

endif.

endmodule.

module user_command_0100 input.

save_ok = ok_code.

clear ok_code.

case save_ok.

when 'EXIT'.

leave program.

endcase.

endmodule.

form create_tree."定义创建树方法

create object wa_custom_container"创建容器对象

exporting

container_name = wa_container."参数用来关联屏幕中创建的容器

create object wa_tree"创建树对象

exporting

parent = wa_custom_container"确定树控件所在的容器

node_selection_mode = cl_gui_simple_tree=>node_sel_mode_single."???????

clear node1.

*设置节点

node1-node_key = '国家'."node_key

*和其他node的关系

clear node1-relatkey."relatkey:关联的node的key

clear node1-relatship."关系

node1-hidden = ''.

node1-disabled = ''.

node1-isfolder = 'X'.

clear node1-N_image.

clear node1-exp_image.

clear node1-expander.

node1-text = '中国'.

append node1 to node_table.

clear node1.

  • 设置第二个节点.

node1-node_key = '城市北京'.

node1-relatkey = '国家'.

node1-relatship = cl_gui_simple_tree=>relat_last_child.

node1-hidden = ''.

node1-disabled = ''.

node1-isfolder = 'X'.

clear node1-n_image.

clear node1-exp_image.

clear node1-expander.

node1-text = '北京'.

append node1 to node_table.

clear node1.

call method wa_tree->add_nodes

exporting

table_structure_name = 'MTREESNODE'

node_table = node_table.

endform.

Edited by: Alex Zhang on Aug 13, 2008 8:52 AM

Edited by: Alex Zhang on Aug 13, 2008 8:53 AM

2 REPLIES 2

karsten_korte
Participant
0 Kudos
40

hmm, it works for me.

And the custom_containers name in dynpro 100 is really 'TREE'?

regards, Karsten

0 Kudos
40

hi,

As soon as I posted this thread I solved my proplem.At beginning i created a subscreen area instead of the needed custom container.

hehe... anyway thank you very much.

alex.