Programme SAP CMSR_GEN_QUAL_MAP - Beispiel: List Tree Control (With Documentation)


This text exactly the same as RE CMSR_MAP_QUAL_MAP

Description
Report SAPTLIST_TREE_CONTROL_DEMO demonstrates the use of the list treecontrol (class CL_GUI_LIST_TREE).
One node of the tree is described with dictionary structure TREEV_NODE.The NODE_KEY field contains the node key.
Each node of the tree can own items. An item is described by thedictionary structure TREEV_ITEM, to which the user of the tree controlmust add the character field TXT (any desired length). In the samplereport, TREEV_ITEM is included in structure MTREEITM, in order to inserta field with the name TEXT. The NODE_KEY field dictates to which node anitem belongs. The ITEM_NAME field contains the name of this item. Onlyintegers greater than or equal to 1 are allowed. The items in a node areoutput from left to right.
The example demonstrates some important characteristics of the list treecontrol, which is explained using some of the items as follows:

  • Item "Objects": This item has proportional font (ITEM-FONT =
  • CL_GUI_LIST_TREE=>ITEM_FONT_PROP). The use of a proportional font onlymakes sense for items if the width of the item is automatically matchedto the text string that is received (so that the string alway s fits).To do so, the value CL_GUI_LIST_TREE=>ALIGN_AUTO must be written intothe item's ALIGNMENT field.
    • A table structure is created for the items in the nodes that are third
    • and fourth from the top. In this case, it is necessary for the firstthree items of both nodes to have fixed lengths. (ITEM-ALIGNMENT =CL_GUI_LIST_TREE=>ALIGN_LEFT, ITEM-LENGTH = ...). A fixed font(ITEM-FONT = ITEM_FONT_FIXED) must be used for these items.

      Selection
      The items of a node can be selected individually. A click on the folderor page symbol of a node selects the entire node.
      You can also set the selection behavior of the tree so that one clickalways selects the entire node (ITEM_SELECTION-Set the parameter for theconstructor to initial).

      Events
      The events that occur appear on the right side of the screen. In thesample program, you can trigger the following events:

      node_dbl_clk (node double-click)
      A node is double-clicked. In the sample program, you can do so bydouble-clicking on the folder or page symbol. If ITEM_SELECTION is setto SPACE, this event is triggered if any section of the node isdouble-clicked.

      item_dbl_click (item double-click)
      An item in the tree was double-clicked. This event can only occur whenITEM_SELECTION = X.

      expand_nc (expand no children)
      A node can have the characteristic that it displays a plus symbol (+)for a folder or page, even when there are no lower-level nodes(children).To make this setting, use the expander field in TREEV_NODE.If users click on one of these nodes, the EXPAND_NC event is triggered.In the example, node Program has this characteristic. The sampleprogram reacts to these events by copying two new nodes to the control.

      button_click
      The user clicked a button.

      link_click
      The user clicked a link item.