cl_gui_alv_tree_simple
DATA ls_list_comm TYPE slis_t_listheader.
DATA ls_alist_comm TYPE slis_listheader.
ls_alist_comm-typ = 'H'.
ls_alist_comm-info = '科目映射关系'.
*
APPEND ls_alist_comm TO ls_list_comm.
"填充输出结构
PERFORM sub_fieldcat.
"控制输出层次
PERFORM sub_field_level.
CREATE OBJECT wa_custom_container_tree
EXPORTING
container_name = wa_container_tree.
CREATE OBJECT tree_grid
EXPORTING
i_parent = wa_custom_container_tree.
CALL METHOD tree_grid->set_table_for_first_display
EXPORTING
it_list_commentary = ls_list_comm
i_structure_name = 'Z_KEMU_INFOR'
CHANGING
it_sort = gb_sortfld
it_fieldcatalog = gb_fieldcat
it_outtab = g_kemu_show[].
*
CALL METHOD tree_grid->expand_tree
EXPORTING
i_level = 1.
ENDFORM. "sub_creat_tree
我没找到 刷新 refresh功能
最后没辙,只有按以下方法实现了,谁有好的办法请留言
我是在输入条件后,点查询,以树状展现
FORM sub_creat_tree.
"每次执行查询后,先清空,然后再去重新创建对象
IF wa_custom_container_tree IS NOT INITIAL.
CALL METHOD tree_grid->free.
CALL METHOD wa_custom_container_tree->free.
CLEAR tree_grid.
CLEAR wa_custom_container_tree.
ENDIF.
IF wa_custom_container_tree IS INITIAL AND g_kemu_show[] IS NOT INITIAL.
*
*
ENDFORM.
其实,这个对于cl_gui_simple_tree
的刷新同样适用
虽然有人说cl_gui_simple_tree
的 UPDATE_NODES 可以更新,但是我没测试出来,
如果谁有测试代码,可以发一下,留言也行,谢谢