SAP Function RS_TREE_LIST_DISPLAY - Display hierarchy

Parameter Reference Type Length Default Optional Text
CALLBACK_COLOR_DISPLAY 0 X EXIT routine for color legend
CALLBACK_CONTEXT_MENU 0 X EXIT routine for constructing the context menu
CALLBACK_GUI_STATUS 0 X EXIT routine for setting a GUI status
CALLBACK_MOREINFO_DISPLAY 0 X EXIT routine to node supplementary information
CALLBACK_PROGRAM SYST-REPID C 40 X Program containing the EXIT routines
CALLBACK_TEXT_DISPLAY 0 X EXIT routine for node display
CALLBACK_TOP_OF_PAGE 0 X EXIT routine for TOP-OF-PAGE display
CALLBACK_USER_COMMAND 0 X EXIT routine for command handling
CHECK_DUPLICATE_NAME 0 '1' X Test for duplicate names
COLOR_OF_LINK 0 '1' X Color of a link node
COLOR_OF_MARK 0 '3' X Color of a selected node
COLOR_OF_MATCH 0 '5' X Color of a found node
COLOR_OF_NODE 0 '4' X Node color (standard)
LAYOUT_MODE STREE_LAYOUT_MODE 0 SPACE X Tree display normal/ compressed
LOWER_CASE_SENSITIVE 0 SPACE X 'X' if case-sensitive
MODIFICATION_LOG 0 SPACE X 'X' if modification log required
NODE_LENGTH 0 30 X Output length of a node
RETURN_MARKED_SUBTREE 0 SPACE X 'X' if selected sub-nodes are to be taken into account
SCREEN_END_COLUMN 0 0 X Column where list dialog box ends
SCREEN_END_LINE 0 0 X Line where list dialog box ends
SCREEN_START_COLUMN 0 0 X Column where list dialog box begins
SCREEN_START_LINE 0 0 X Line where list dialog box begins
STATUS 0 'IMPLICIT' X Status display ('OWN', 'STANDARD', 'IMPLICIT')
SUPPRESS_NODE_OUTPUT 0 SPACE X 'X' suppresses the node display
TEXT_LENGTH 0 75 X Length of text block 1
TEXT_LENGTH1 0 0 X Length of text block 2
TEXT_LENGTH2 0 0 X Length of text block 3
USE_CONTROL STREE_USE_MODE 0 STREE_USE_LIST X Display as list or tree control

Parameter Reference Type Length Text
F15 0 Function key F15 pressed

Functionality
Function module enabling you to display and interactively manipulatehierarchies and graphs in which unused graphical links are displayed ina different color as link nodes.
A hierarchy must exist, at least in its initial state, before you canuse this module.
You have three possibilites:
- You can create a hierarchy with root nodes using module
RS_TREE_CREATE.
- You can copy a complete hierarchy to the function group using the
RS_TREE_CONSTRUCT module. All the parent-child relationships must
be calculated explicitly.
- You can use module RS_TREE_SET_CURRENT_TREE to copy a data cluster
which you have already procured using module
RS_TREE_GET_CURRENT_TREE to the function group. This cluster is
already in the correct format for internal display and may not be
changed. This is used exclusively for internal management (INDX
format).
The modules RS_TREE_GET_LINKTAB and RS_TREE_SET_LINKTAB also exist
for graph management.
You have the option of displaying the hierarchy in a list dialog box.
The SCREEN* parameters are used for this.
The function code TRCL displays a color key with the various colorsused in the function group.
Using the EXIT routine
form COLOR_DISPLAY tables COLORTAB structure SEUCOLOR
the caller can add user-defined colors using the exit routin eCALLBACK_TEXT_DISPLAY.

Description
A subroutine with the form
FORM callback_context_menu
,,USING ,,node LIKE snodetext
,,,,,,menu TYPE REF TO cl_ctmenu.
is called when the user requests a context menu (right mouse button).
This only works if you use the standard function key status or define afunction for Shift+F10 in your own status.
In the routine, you can construct the context menu using the methods ofclass CL_CTMENU. The menu is displayed by the runtime system.
Example program
CTMENU_TREE_LIST
A subroutine with the form
FORM moreinfo_display
TABLES moreinfo STRUCTURE streeattr
USING node LIKE streenode.
is called after the node describe in NODE has been output, if theMOREINFO field for the node has been set to 'X'.
The structure of table MOREINFO corresponds to that of the attributepart of a node in respect of how it can be set in the callback routineTEXT_DISPLAY.
The texts stored in MOREINFO are displayed line-by-line under thecorresponding node.
Program containing exit routines. The program should always be eitherthe main program or a function group.
A subroutine of the form
FORM text_display
TABLES nodes STRUCTURE snodetext.
is called (if specified) each time the hierarchy is rebuilt.
The NODES table contains all of the nodes to be displayed. Based on thetype and name of a node, you can set its display length, color, and adescriptive text. The output length specified here overrides the outputlength specified in the IMPORT parameter NODE_LENGTH. Its default (andmaximum) length is 30. The function group notes texts that have beenpassed to it and, when the node is subsequently redisplayed, suggeststhe same text.
The field LINK is set to 'X' for link nodes (see CHECK_DUPLICATE_NAMEtype '3')The function code TRCL displays a color key with the various colorsused in the function group.
Using the EXIT routine
form COLOR_DISPLAY tables COLORTAB structure SEUCOLOR
the caller can add user-defined colors using the exit routineCALLBACK_TEXT_DISPLAY.

Description
An EXIT routine specified by the caller must have the following form:
FORM user_command tables node STRUCTURE seucomm
using command
changing exit
list_refresh.
In this case, the status set by the caller is used.
The function group takes control over the chosen command and passes thenodes to the subroutine for processing.
The function code is passed in the COMMAND parameter.
If the return parameter EXIT is set ( <> SPACE ), the function moduleterminates immediately.
The LIST_REFRESH parameter controls the display following commandhandling.
LIST_REFRESH = 'X': Default
The list is reconstructed and the nodes are
deselected.
= 'M': The list is reconstructed and the selected
nodes are not deselected.
= ' ': The list is not reconstructed.
The structure SEUCOMM contains the following components:
NAME : Selected node
ID : ID of the selected node
TYPE : Type of the selected node
PARENT : ID of the parent node
CHILD : ID of the first child node
NEXT : ID of the next same-level node
NEWNAME : New node name (see: TRAD, TRRN, TRMV)
NEWCHILD : 'X' if the new node is to be created (TRAD) or
reassigned (TRMV) as a child node
NEWTYPE : Node type when creating (TRAD) new nodes
TEXT : Short text of the nodes
LINK_ID : ID of the reference node with the same name (only if
parameter CHECK_DUPLICATE_NAME has the value '3'.)
LINK_TYPE: Type of the reference node with the same name.
OK : 'X' if the operation is succesful.
In this case, the operation on the node is carried out.
The function module handles the following function codes:
TRRF: Refresh the hierarchy display
TRSL: Choose (always assigned to F2)
Expands or collapses a subtree depending on the cursor
position. If a node is selected, the function code is
passed to the EXIT routine.
TREP: Expands the hierarchy fully from the cursor position
onwards. If the cursor is not positioned on a node, the
entire hierarchy is expanded.
TRCM: Collapses the tree completely to the first level.
TRN+: Expands the next same-level node by one level.
The node on which the cursor is positioned is compressed.
TRN-: Expands the previous same-level node by one level.
The node on which the cursor is positioned is compressed.
TRG+: Returns from a reference node to the original node.
The navigation is stacked (-> TRG-).
It only makes sense to use this function if the parameter
CHECK_DUPLICATE_NAME = '3'.
TRG-: Returns from the original node to the reference node.
If TRG+ has occurred several times in succession, this
function empties the stack step by step.
TRZM: Sets the focus on the selected node. In other words,
the node becmes the first node in the hierarchy.
At the same time, the navigation path appears at the top
of the list, indicating the path from the root node to the
first node of the display.
TRMK: Selects or deselects nodes. If the node has children, the
selection or deselection also applies to them.
TRAD: Adds nodes
The new node (NODE-NEWNAME) is passed to the EXIT routine
for checking. The relationship is contained in NODE-CHILD.
If the exit routine returns NODE-OK = 'X', the node is
appended.
Caution: If the function parameter SUPPRESS_NODE_OUTPUT
is set to 'X', NODE-NEWNAME is empty, and the
text of the new node is in NODE-TEXT.
In diesem Fall muss die Exit-Routine das Feld
NODE-NEWNAME füllen.
TRDL: Deletes nodes
Control passes to the caller. If NODE-OK = 'X', the node
(or entire subtree) is deleted.
TRRN: Renames nodes
The new node name (NODE-NEWNAME) is passed to the EXIT
routne for checking. If NODE-OK = 'X' is returned, the
node is renamed.
Caution: If the function parameter SUPPRESS_NODE_OUTPUT
is set to 'X', NODE-NAME = NODE-NEWNAME.
The field NODE-TEXT contains the renamed text.
TRMV: Reassigns selected nodes
Control is passed to the EXIT routine; NODE-NEWNAME contains
the node to be appended, and NODE-NAME contains the node
to which it is to be appended. NODE-NEWCHILD contains the
relationship between the two.
TRCL: Color key
TRRT: Back ( F3 )
Calls the EXIT routine. If EXIT = 'X', the function module
is terminated.
BACK: Terminates the function module without calling the EXIT
routine.
TREX: Exit ( F15 )
Calls the EXIT routine. If EXIT = 'X', the function module
is terminated and the export parameter F15 is set.
EXIT: The function module is terminated without the exit routine
being called.
The export parameter F15 is set.
%SC: Search in the (displayed) list.
%PRI: Print
%PC: Dowload
All other function codes are passed directly to the exit routine.
If the caller does not specify an exit routine, the function modulesends its own status containing the above functions.
When you rename (TRRN) or create (TRAD) a node, the system checks thatit is unique.
Possible values:
'0': No check
'1': Name must be unique within the entire hierarchy
'2': Name must be unique within the same level of the hierarchy
(nodes with the same parent)
'3': If a node with this name already exists, the system creates a
node to it. Reference nodes are displayed in a different
color (parameter COLOR_OF_LINK).
You cannot append further nodes to reference nodes.
This parameter is only effective if the parameter CHECK_DUPLICATE_NAMEhas the value '3'.
Standard display for a node. You can override it in the exit routineCALLBACK_TEXT_DISPLAY.
You can use this to set the general node length. In the exit routineCALLBACK_TEXT_DISPLAY, you can override it for each individual node(depending on type). If you do this, you should set NODE_LENGTH to thehighest possible value for the application.
Example:
The node length in the hierarchy can be between 10 and 30. You shouldtherefore set NODE_LENGTH to 30.

Description
Controls the nodes that should be passed with the exit routineCALLBACK_USER_COMMAND.

Value range
' ': Only the roots of selected subtrees are passed
'X': All selected nodes of the hierarchy are passed

Default
SPACE

Description
Parameters controlling the status display

Value range
Values:
'OWN': The caller has set its own status
'STANDARD': The standard status of the function group is used
'IMPLICIT': Implicit decision as to the status. If the parameter
CALLBACK_USER_COMMAND is not set, the function module
sets the 'STANDARD' status. If the parameter is set,
the status of the caller remains set (as with 'OWN').

Default
'IMPLICIT' for compatibility reasons.
Sometimes only the long text of a node is relevant, and not the nodeitself (for example, if the node only contains key information). Ifthis parameter is set to 'X', only the long text is displayed.
The parameter NODE_LENGTH and the color and length details in the exitroutine CALLBACK_TEXT_DISPLAY then refer to this text.