Start of Content Area

Syntax documentation add_node  Locate the document in its SAP Library structure

Use this method to add a node to the List Tree Model. The node is initially only added to the tree model at the backend. It is automatically transferred to the tree display at the frontend at the end of the next PBO event.

CALL METHOD list_model->add_node
      EXPORTING node_key          = node_key
                relative_node_key = relative_node_key
                relationship      = relationship
                isfolder          = isfolder
                hidden            = hidden
                disabled          = disabled
                style             = style
                no_branch         = no_branch
                expander          = expander
                image             = image
                expanded_image    = expanded_image
                drag_drop_id      = drag_drop_id
                last_hitem        = last_hitem
                user_object       = user_object
                items_incomplete  = items_incomplete
                item_table        = item_table.

Parameter and Type

Opt.

Description

node_key
TYPE STRING

 

The key by which the node is identified in the tree. This must be unique throughout the tree. You should only use letters, digits, and the underscore character in node keys.

relative_node_key
TYPE STRING

X

The key of a node to which the new node is related in position. If the new node is the first or last root node, this parameter must have the value ' ' .

relationship
I

X

The relationship between the new node and the node specified in relative_node_key . Possible values are:

  • CL_TREE_MODEL=>RELAT_FIRST_CHILD
    Inserts the new node as the first child node of the node specified in
    relative_node_key . This must be a folder.
  • CL_TREE_MODEL=>RELAT_LAST_CHILD
    Inserts the new node as the last child node of the node specified in relative_node_key . This must be a folder.
  • CL_TREE_MODEL=>RELAT_PREV_SIBLING
    Inserts the new node directly before the related node at the same level.
  • CL_TREE_MODEL=>RELAT_NEXT_SIBLING
    Inserts the new node directly after the related node at the same level.
  • CL_TREE_MODEL=>RELAT_FIRST_SIBLING
    Inserts the new node as the first node at the same level as the related node.
  • CL_TREE_MODEL=>RELAT_LAST_SIBLING
    Inserts the new node as the last node at the same level as the related node.

Note: If relative_node_key is empty, the new node is inserted as a root node. Where the above values contain the word FIRST or PREV , it is inserted as the first root node. Where they contain LAST or NEXT , it is inserted as the last.

isfolder
TYPE AS4FLAG

 

Specifies whether the new node should be a folder or a leaf. Possible values:

  • 'X' : Node is a folder
  • ' ' : Node is a leaf

hidden
TYPE AS4FLAG

X

Specifies whether the node should be hidden ( 'X' ) or visible
(
' ' ). Default is visible.

disabled
TYPE AS4FLAG

X

Specifies whether the node can be selected ( ' ' ) or not ( 'X' ). The default is not disabled.

Note: If a node is disabled, actions such as double-clicking it have no effect.

style
TYPE AS4FLAG

X

Sets the colors of the text and the background for the node. The possible values for this field are any static constant CL_TREE_MODEL=>STYLE_* . For further details, refer to the definition of CL_TREE_MODEL in the Class Builder.

no_branch
TYPE AS4FLAG

X

Specifies whether connecting lines should be drawn between the nodes ( ' ' ) or not ( 'X' ). The default is for the lines to be drawn.

expander
TYPE AS4FLAG

X

May only be set for a folder. If you set this attribute, the closed folder always displays a '+' symbol, even if it is empty. When the user clicks on the folder, the event EXPAND_NO_CHILDREN is triggered.

image
TYPE C(6)

X

Specifies the image used for the node. Possible values:

  • initial: The system uses the default values (leaf symbol for a leaf, closed folder symbol for a folder)
  • '@XY@' : An SAP icon with the code XY .
  • 'BNONE' : No image is displayed. The node text begins at the position in which the image would normally be displayed. If you use this value for a node, you should also use it for all of its other same-level nodes.

expanded_image
TYPE C(6)

X

Specifies the image used for an open folder. The possible values are the same as those listed above for the image parameter.

drag_drop_id
TYPE I

X

Only relevant if you want the node to be drag and drop-enabled. It contains the handle for a drag and drop object.

last_hitem
TYPE STRING

X

The name of the last item to appear under the hierarchy heading

user_object
TYPE REF TO OBJECT

X

Can be assigned any reference to an application object

items_incomplete
TYPE AS4FLAG

X

Flag indicating that the items table is incomplete. In this case, you load the items on demand. For further information, refer to Loading Items on Demand.

item_table

TYPE TREEMLITAB

 

Table of items for the node with the line type TREEMLITEM . For further information, refer to the documentation of the structure in the ABAP Dictionary.