Ansicht
Dokumentation

SAPCOLUMN_TREE_CONTROL_DEMO - Example: Column Tree Control (with Documentation)

SAPCOLUMN_TREE_CONTROL_DEMO - Example: Column Tree Control (with Documentation)

Vendor Master (General Section)   BAL Application Log Documentation  
This documentation is copyright by SAP AG.
SAP E-Book

Description

This program demonstrates a tree control with columns (class CL_GUI_COLUMN_TREE).

In a COLUMN_TREE, the entries in each node (item) are organized in columns. The tree in this example has three columns with the logical names 'Column1', 'Column2', and 'Column3'. The topmost node has an entry in each of these columns:

  • 'Root Col. 1' in column 'Column1'
  • 'Root Col. 2' in column 'Column2'
  • 'Root Col. 3' in column 'Column3'

A COLUMN_TREE has two kinds of column:

  • Columns in the hierarchy area: These columns appear underneath the hierarchy header. The hierarchy header is the first header from the left in the control ('Hierarchy Header' in the example). There is usually only one column in the hierarchy area. In the example, this is the column with the name 'Column1', which contains the entries 'Root Col.1 ', 'Child1 Col. 1' and so on.
  • Columns outside the hierarchy area: These columns have their own header. In the example, there are two such columns, with the headers 'Column2' and 'Column3'.

Each node in the tree is described by the ABAP Dictionary structure TREEV_NODE. The field NODE_KEY contains the node key.
Each node in the tree can have items; each item is described by the ABAP Dictionary structure TREEV_ITEM, which the user of the tree control must extend by the character field TEXT (any length). In the example program, TREEV_ITEM is included in the structure MTREEITM, which also contains a field called TEXT. The NODE_KEY field determines the node to which an item belongs. The ITEM_NAME field defines the column in which the item appears.
Example: Below are the three items from the topmost root node:

NODE_KEY ITEM_NAME TEXT

Root Column1 Root Col. 1
Root Column2 Root Col. 2
Root Column3 Root Col. 3

Selection

The items of a node can be selected individually. If you click the folder or leaf symbol of a node, the entire node is selected.
You can set the selection method of the tree so that every click, wherever it occurs, always selects the entire node (set the ITEM_SELECTION parameter of the constructor method to initial). In this case, you cannot use pushbuttons, links, or changeable checkboxes.

Events

The program displays events as they occur in the right-hand frame on the screen. The following events can be triggered in the example program:

node double click

Double click on a node. In the example, you have to double-click the folder or leaf symbol of the node. If ITEM_SELECTION is set to SPACE, the event is triggered when you double-click anywhere on the node.

item double click

Double click on an item in the tree. This event can only occur if ITEM_SELECTION = 'X'.

expand no children

A node can display a plus sign in its folder symbol, even though it has no child nodes (you need to set the EXPANDER field in TREEV_NODE). If the user clicks one of these nodes, the EXPAND_NO_CHILDREN event is triggered. In the example, the node "Child1" has this attribute. The example program reacts to this event by passing two new nodes to the control (New1 and New2).

header_click

The user clicked a header in the control. The program displays the name of the header in the output field node_key.

button_click

The user clicked a pushbutton item.

link_click

The user clicked a link item.

Requirements

Output

Example






Addresses (Business Address Services)   ABAP Short Reference  
This documentation is copyright by SAP AG.

Length: 3891 Date: 20240531 Time: 174024     sap01-206 ( 76 ms )