直接上代码
代码语言:javascript复制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 .
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