我想以cl_gui_alv_tree
编程方式更改布局。我目前的方法不起作用。这是我到目前为止的代码,在屏幕的 PBO 中执行:
CALL METHOD gs_0700-s_tree-r_tree->delete_all_nodes
EXCEPTIONS
failed = 1
cntl_system_error = 2
OTHERS = 3.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
PERFORM load_new_tree_nodes.
ls_vari-report = gs_0700-repid.
ls_vari-handle = 'TREE'.
ls_vari-variant = '/new_variant'
(...)
CALL METHOD gs_0700-s_tree-r_tree->set_variant_key
EXPORTING
is_variant = ls_vari.
CALL METHOD gs_0700-s_tree-r_tree->column_optimize.
CALL METHOD gs_0700-s_tree-r_tree->update_calculations.
CALL METHOD gs_0700-s_tree-r_tree->frontend_update.
重新绘制树并加载新节点。甚至列也得到了优化。一切都变了,但布局变体没有变。它看起来总是像我在树初始化期间/default
使用该方法设置的布局变体。set_table_for_first_display
我创建了变体/new_variant
,我可以通过工具栏加载它。
还有其他方法可以以编程方式更改树的布局变体吗?