0

我想以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,我可以通过工具栏加载它。

还有其他方法可以以编程方式更改树的布局变体吗?

4

1 回答 1

0

SET_TABLE_FOR_FIRST_DISPLAY用参数调用方法I_DEFAULT = space吗?

默认设置将'X'导致始终显示默认变体。

于 2013-09-09T08:27:12.940 回答