SAP Function Modules

CA_TR_DISPLAY_TREE_STRUCTURE SAP Function module - Graphical display of tree structure with variable list blocks







CA_TR_DISPLAY_TREE_STRUCTURE is a standard SAP function module available within R/3 SAP systems depending on your version and release level. Below is the pattern details for this FM showing its interface including any import and export parameters, exceptions etc as well as any documentation contributions (Comments) specific to the object.

See here to view full function module documentation and code listing, simply by entering the name CA_TR_DISPLAY_TREE_STRUCTURE into the relevant SAP transaction such as SE37 or SE80.

Associated Function Group: CATR
Released Date: Not Released
Processing type: Normal fucntion module
Normal function module settings


Pattern for FM CA_TR_DISPLAY_TREE_STRUCTURE - CA TR DISPLAY TREE STRUCTURE





CALL FUNCTION 'CA_TR_DISPLAY_TREE_STRUCTURE' "Graphical display of tree structure with variable list blocks
  EXPORTING
*   checkboxes_left_justified = SPACE  " hierarchy-checkbox  Place all checkboxes on right-hand edge
*   display_obj_types = SPACE   " hierarchy-checkbox  Show object types
*   display_root_obj_type = SPACE  " hierarchy-checkbox  Show ROOT object type
*   ending_column = '60'        "               End column for dialog box
*   ending_row = '20'           "               End line for dialog box
*   list_as_popup = SPACE       " hierarchy-checkbox  Show tree graphic as dialog box
    list_id =                   " klah-class    List name for variable lists
    list_status =               " sy-pfkey      PF status to be set on list
    list_title =                "               Title bar for list
*   no_checkboxes = SPACE       " hierarchy-checkbox  Hide all checkboxes
*   position_at_selected_line = SPACE  " hierarchy-checkbox  Place cursor on selected line
    profile =                   " klah-class    Profile for variable lists
*   root_node_checkbox = SPACE  " hierarchy-checkbox  Show checkbox for root node
*   root_node_checkbox_input_on = SPACE  " hierarchy-input_on  Checkbox available for entry for root node
    root_node_list_block =      " hierarchy-list_block  List block for root node
    root_node_obj_length =      " hierarchy-obj_length  Output length of ROOT_NODE_OBJ_TYPE
    root_node_obj_type =        " hierarchy-obj_type  Object type of root node
    root_node_value_id =        " hierarchy-value_id  Pointer to values table
    root_parent =               " hierarchy-parent  Top superior object in hierarchy
*   starting_column = '20'      "               First line of dialog box
*   starting_row = '05'         "               First line of dialog box
*   title_var_delimiter = '?'   " tcis-delim    Variable string for title line
*   title_var_string = SPACE    " message-msgtx  Separator in variable string
  IMPORTING
    action =                    " sy-ucomm      Function selected on tree structure
    line_number =               " sy-tabix      Table line selected in tree structure
  TABLES
    selected_entries =          " hierarchy     Lines selected in tree structure
    tree_structure =            " hierarchy     Structure of tree
    value_table =               " hier_block    Values table
  EXCEPTIONS
    TREE_NOT_CONSISTENT = 1     "               Tree structure not consistent
    .  "  CA_TR_DISPLAY_TREE_STRUCTURE

ABAP code example for Function Module CA_TR_DISPLAY_TREE_STRUCTURE





The ABAP code below is a full code listing to execute function module CA_TR_DISPLAY_TREE_STRUCTURE including all data declarations. The code uses the latest in-line data DECLARATION SYNTAX but I have included an ABAP code snippet at the end to show how declarations would look using the original method of declaring data variables up front. This will allow you to compare and fully understand the new inline method. Please note some of the newer syntax such as the @DATA is not available until a later 4.70 service pack (SP8).

DATA:
ld_action  TYPE SY-UCOMM ,
ld_line_number  TYPE SY-TABIX ,
it_selected_entries  TYPE STANDARD TABLE OF HIERARCHY,"TABLES PARAM
wa_selected_entries  LIKE LINE OF it_selected_entries ,
it_tree_structure  TYPE STANDARD TABLE OF HIERARCHY,"TABLES PARAM
wa_tree_structure  LIKE LINE OF it_tree_structure ,
it_value_table  TYPE STANDARD TABLE OF HIER_BLOCK,"TABLES PARAM
wa_value_table  LIKE LINE OF it_value_table .


DATA(ld_checkboxes_left_justified) = some text here

DATA(ld_display_obj_types) = some text here

DATA(ld_display_root_obj_type) = some text here
DATA(ld_ending_column) = 'some text here'.
DATA(ld_ending_row) = 'some text here'.

DATA(ld_list_as_popup) = some text here

SELECT single CLASS
FROM KLAH
INTO @DATA(ld_list_id).

DATA(ld_list_status) = 'some text here'.
DATA(ld_list_title) = 'some text here'.

DATA(ld_no_checkboxes) = some text here

DATA(ld_position_at_selected_line) = some text here

SELECT single CLASS
FROM KLAH
INTO @DATA(ld_profile).


DATA(ld_root_node_checkbox) = some text here

DATA(ld_root_node_checkbox_input_on) = some text here

DATA(ld_root_node_list_block) = some text here

DATA(ld_root_node_obj_length) = Check type of data required

DATA(ld_root_node_obj_type) = some text here

DATA(ld_root_node_value_id) = 123

DATA(ld_root_parent) = some text here
DATA(ld_starting_column) = 'some text here'.
DATA(ld_starting_row) = 'some text here'.

SELECT single DELIM
FROM TCIS
INTO @DATA(ld_title_var_delimiter).


DATA(ld_title_var_string) = some text here

"populate fields of struture and append to itab
append wa_selected_entries to it_selected_entries.

"populate fields of struture and append to itab
append wa_tree_structure to it_tree_structure.

"populate fields of struture and append to itab
append wa_value_table to it_value_table. . CALL FUNCTION 'CA_TR_DISPLAY_TREE_STRUCTURE' EXPORTING * checkboxes_left_justified = ld_checkboxes_left_justified * display_obj_types = ld_display_obj_types * display_root_obj_type = ld_display_root_obj_type * ending_column = ld_ending_column * ending_row = ld_ending_row * list_as_popup = ld_list_as_popup list_id = ld_list_id list_status = ld_list_status list_title = ld_list_title * no_checkboxes = ld_no_checkboxes * position_at_selected_line = ld_position_at_selected_line profile = ld_profile * root_node_checkbox = ld_root_node_checkbox * root_node_checkbox_input_on = ld_root_node_checkbox_input_on root_node_list_block = ld_root_node_list_block root_node_obj_length = ld_root_node_obj_length root_node_obj_type = ld_root_node_obj_type root_node_value_id = ld_root_node_value_id root_parent = ld_root_parent * starting_column = ld_starting_column * starting_row = ld_starting_row * title_var_delimiter = ld_title_var_delimiter * title_var_string = ld_title_var_string IMPORTING action = ld_action line_number = ld_line_number TABLES selected_entries = it_selected_entries tree_structure = it_tree_structure value_table = it_value_table EXCEPTIONS TREE_NOT_CONSISTENT = 1 . " CA_TR_DISPLAY_TREE_STRUCTURE
IF SY-SUBRC EQ 0. "All OK ELSEIF SY-SUBRC EQ 1. "Exception "Add code for exception here ENDIF.







ABAP code to compare 7.40 inline data declaration with original syntax

The below ABAP code uses the older none in-line data declarations. This allows you to see the coding differences/benefits of the later inline syntax. It may also be useful if you are using an older version of SAP as some of the newer syntax above, such as the @DATA is not available until 4.70 EHP 8.

DATA:
ld_action  TYPE SY-UCOMM ,
ld_checkboxes_left_justified  TYPE HIERARCHY-CHECKBOX ,
it_selected_entries  TYPE STANDARD TABLE OF HIERARCHY ,
wa_selected_entries  LIKE LINE OF it_selected_entries,
ld_line_number  TYPE SY-TABIX ,
ld_display_obj_types  TYPE HIERARCHY-CHECKBOX ,
it_tree_structure  TYPE STANDARD TABLE OF HIERARCHY ,
wa_tree_structure  LIKE LINE OF it_tree_structure,
ld_display_root_obj_type  TYPE HIERARCHY-CHECKBOX ,
it_value_table  TYPE STANDARD TABLE OF HIER_BLOCK ,
wa_value_table  LIKE LINE OF it_value_table,
ld_ending_column  TYPE STRING ,
ld_ending_row  TYPE STRING ,
ld_list_as_popup  TYPE HIERARCHY-CHECKBOX ,
ld_list_id  TYPE KLAH-CLASS ,
ld_list_status  TYPE SY-PFKEY ,
ld_list_title  TYPE STRING ,
ld_no_checkboxes  TYPE HIERARCHY-CHECKBOX ,
ld_position_at_selected_line  TYPE HIERARCHY-CHECKBOX ,
ld_profile  TYPE KLAH-CLASS ,
ld_root_node_checkbox  TYPE HIERARCHY-CHECKBOX ,
ld_root_node_checkbox_input_on  TYPE HIERARCHY-INPUT_ON ,
ld_root_node_list_block  TYPE HIERARCHY-LIST_BLOCK ,
ld_root_node_obj_length  TYPE HIERARCHY-OBJ_LENGTH ,
ld_root_node_obj_type  TYPE HIERARCHY-OBJ_TYPE ,
ld_root_node_value_id  TYPE HIERARCHY-VALUE_ID ,
ld_root_parent  TYPE HIERARCHY-PARENT ,
ld_starting_column  TYPE STRING ,
ld_starting_row  TYPE STRING ,
ld_title_var_delimiter  TYPE TCIS-DELIM ,
ld_title_var_string  TYPE MESSAGE-MSGTX .


ld_checkboxes_left_justified = some text here

"populate fields of struture and append to itab
append wa_selected_entries to it_selected_entries.

ld_display_obj_types = some text here

"populate fields of struture and append to itab
append wa_tree_structure to it_tree_structure.

ld_display_root_obj_type = some text here

"populate fields of struture and append to itab
append wa_value_table to it_value_table.
ld_ending_column = 'some text here'.
ld_ending_row = 'some text here'.

ld_list_as_popup = some text here

SELECT single CLASS
FROM KLAH
INTO ld_list_id.

ld_list_status = 'some text here'.
ld_list_title = 'some text here'.

ld_no_checkboxes = some text here

ld_position_at_selected_line = some text here

SELECT single CLASS
FROM KLAH
INTO ld_profile.


ld_root_node_checkbox = some text here

ld_root_node_checkbox_input_on = some text here

ld_root_node_list_block = some text here

ld_root_node_obj_length = Check type of data required

ld_root_node_obj_type = some text here

ld_root_node_value_id = 123

ld_root_parent = some text here
ld_starting_column = 'some text here'.
ld_starting_row = 'some text here'.

SELECT single DELIM
FROM TCIS
INTO ld_title_var_delimiter.


ld_title_var_string = some text here

Contribute (Add Comments)

Please help keep this info upto date and use the comments section below to add useful hints, tips and information specific to this SAP function. This will then be available for you and other users to easily find by simply searching on the object name CA_TR_DISPLAY_TREE_STRUCTURE or its description.