2

I am displaying a list of items using a SAP ABAP column tree model, basically a tree of folder and files, with columns.

I want to load the sub-nodes of folders dynamically, so I'm using the EXPAND_NO_CHILDREN event which is firing correctly.

Unfortunately, after I add the new nodes and items to the tree, the folder is automatically collapsing again, requiring a second click to view the sub-nodes. Do I need to call a method when handling the event so that the folder stays open, or am I doing something else wrong?

* Set up event handling.
  LS_EVENT-EVENTID  = CL_ITEM_TREE_CONTROL=>EVENTID_EXPAND_NO_CHILDREN.
  LS_EVENT-APPL_EVENT = GC_X.
  APPEND LS_EVENT TO LT_EVENTS.
  CALL METHOD GO_MODEL->SET_REGISTERED_EVENTS
    EXPORTING
      EVENTS                    = LT_EVENTS
    EXCEPTIONS
      ILLEGAL_EVENT_COMBINATION = 1
      UNKNOWN_EVENT             = 2.
  SET HANDLER GO_APPLICATION->HANDLE_EXPAND_NO_CHILDREN
    FOR GO_MODEL.

...


* Add new data to tree.
  CALL METHOD GO_MODEL->ADD_NODES
    EXPORTING
      NODE_TABLE = PTI_NODES[]
    EXCEPTIONS
      ERROR_IN_NODE_TABLE = 1.

  CALL METHOD GO_MODEL->ADD_ITEMS
    EXPORTING
      ITEM_TABLE = PTI_ITEMS[]
    EXCEPTIONS
      NODE_NOT_FOUND = 1
      ERROR_IN_ITEM_TABLE = 2.
4

2 回答 2

2

自从我玩 SAP 已经有一段时间了,但是当我遇到困难时,我总是发现 SAP 库特别有用……

我设法为你想出了这个:http: //help.sap.com/saphelp_nw04/helpdata/en/47/aa7a18c80a11d3a6f90000e83dd863/frameset.htm,具体来说:

当您向树模型添加新节点时,将标志 ITEMSINCOM 设置为“X”。
这会通知树模型您要按需加载该节点的项目。

希望能帮助到你?

于 2008-08-18T04:07:19.173 回答
0

你的代码看起来不错,

ADD_NODES_AND_ITEMS如果我要添加节点和项目,我会自己使用该方法;)

除此之外,在添加项目/节点后尝试调用EXPAND_NODE,看看是否有帮助。

于 2008-09-15T14:13:09.137 回答