SAP Program SAPCOLUMN_TREE_CONTROL_DEMO - Example: Column Tree Control (with Documentation)

Description
This program demonstrates a tree control with columns (classCL_GUI_COLUMN_TREE).
In a COLUMN_TREE, the entries in each node (item) are organized incolumns. The tree in this example has three columns with the logicalnames 'Column1', 'Column2', and 'Column3'. The topmost node has anentry 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 theleft in the control ('Hierarchy Header' in the example). There isusually only one column in the hierarchy area. In the example, this isthe column with the name 'Column1', which contains the entries 'RootCol.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 structureTREEV_NODE. The field NODE_KEY contains the node key.
        Each node in the tree can have items; each item is described by theABAP Dictionary structure TREEV_ITEM, which the user of the treecontrol must extend by the character field TEXT (any length). In theexample program, TREEV_ITEM is included in the structure MTREEITM,which also contains a field called TEXT. The NODE_KEY field determinesthe node to which an item belongs. The ITEM_NAME field defines thecolumn 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 thefolder 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 theITEM_SELECTION parameter of the constructor method to initial). In thiscase, you cannot use pushbuttons, links, or changeable checkboxes.

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

        node double click
        Double click on a node. In the example, you have to double-click thefolder 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 ifITEM_SELECTION = 'X'.

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

        header_click
        The user clicked a header in the control. The program displays the nameof the header in the output field node_key.

        button_click
        The user clicked a pushbutton item.

        link_click
        The user clicked a link item.