Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Change Headerline in Treeview

Former Member
0 Likes
533

HI,

im using an Tree (like in SE80) and need a way to change the headerline.

Example: Go to SE80 and look at the Treeline under the Toolbar

On the left you see the "Object" caption with "objectname" and right you see the caption "description".

Is it possible to remove one column of this tree ? for example showing only the objectname ?

Im using ...



 call method go_tree->set_table_for_first_display
    exporting
      is_variant           = gs_variant
      i_save               = 'A'
*      i_default            = 'X'
      is_hierarchy_header  = ls_hierarchy_header
*      is_exception_field   =
*      it_special_groups    =
       it_list_commentary   = lt_list_commentary
       i_logo               = l_logo
*      i_background_id      =
*      it_toolbar_excluding =
*      it_except_qinfo      =
    changing
      it_outtab            = gt_outtab
*      it_filter            =
      it_fieldcatalog      = gt_fcat.

gt_outtab is used with 2 fields but my tree headerline(like caption objectname) is showing more and some with empty caption.

any ideas ?

Edited by: Gordon Breuer on Feb 18, 2009 6:03 PM

HI,

im using an Tree (like in SE80) and need a way to change the headerline.

Example: Go to SE80 and look at the Treeline under the Toolbar

On the left you see the "Object" caption with "objectname" and right you see the caption "description".

Is it possible to remove one column of this tree ? for example showing only the objectname ?

Im using ...



 call method go_tree->set_table_for_first_display
    exporting
      is_variant           = gs_variant
      i_save               = 'A'
*      i_default            = 'X'
      is_hierarchy_header  = ls_hierarchy_header
*      is_exception_field   =
*      it_special_groups    =
       it_list_commentary   = lt_list_commentary
       i_logo               = l_logo
*      i_background_id      =
*      it_toolbar_excluding =
*      it_except_qinfo      =
    changing
      it_outtab            = gt_outtab
*      it_filter            =
      it_fieldcatalog      = gt_fcat.

gt_outtab is used with 2 fields but my tree headerline(like caption objectname) is showing more and some with empty caption.

any ideas ?

Edited by: Gordon Breuer on Feb 18, 2009 6:03 PM

2 REPLIES 2
Read only

Former Member
0 Likes
502

yes.. its possible.. check this code, its working code.. i am using in my development & moved to PRD

DATA: g_application TYPE REF TO lcl_application,

g_custom_container TYPE REF TO cl_gui_custom_container,

g_tree TYPE REF TO cl_simple_tree_model.

  • create a simple tree model instance

CREATE OBJECT g_tree

EXPORTING

node_selection_mode = cl_simple_tree_model=>node_sel_mode_single

EXCEPTIONS

illegal_node_selection_mode = 1.

IF sy-subrc <> 0.

  • MESSAGE a001.

ENDIF.

  • create a container for the tree control

CREATE OBJECT g_custom_container

EXPORTING

container_name = 'TREE_CONTAINER'

EXCEPTIONS

cntl_error = 1

cntl_system_error = 2

create_error = 3

lifetime_error = 4

lifetime_dynpro_dynpro_link = 5.

IF sy-subrc <> 0.

  • MESSAGE a001.

ENDIF.

  • create the view (control) of the tree model

CALL METHOD g_tree->create_tree_control

EXPORTING

parent = g_custom_container

EXCEPTIONS

lifetime_error = 1

cntl_system_error = 2

create_error = 3

failed = 4

tree_control_already_created = 5.

IF sy-subrc <> 0.

  • MESSAGE a001.

ENDIF.

  • define the events which will be passed to the backend

" node double click

event-eventid = cl_simple_tree_model=>eventid_node_double_click.

event-appl_event = 'X'. " process PAI if event occurs

APPEND event TO events.

CALL METHOD g_tree->set_registered_events

EXPORTING

events = events

EXCEPTIONS

illegal_event_combination = 1

unknown_event = 2.

IF sy-subrc <> 0.

  • MESSAGE a001.

ENDIF.

  • assign event handlers in the application class to each desired event

SET HANDLER g_application->handle_node_double_click FOR g_tree.

  • add nodes to the tree model

data: NODE_TABLE_I type TREEMSNOTA,

NODE_I type TREEMSNODT.

DATA: v_text1 type string,

v_cnt(3) type n value 1,

v_key type TM_NODEKEY.

data: v_id type THEAD-TDID,

v_lang type THEAD-TDSPRAS,

v_name type THEAD-TDNAME,

v_thd type THEAD-TDOBJECT.

DATA : v_string TYPE string VALUE '(SAPLCOKO1)CAUFV'.

FIELD-SYMBOLS : <wa> TYPE CAUFV.

*

DATA : w_CAUFV TYPE CAUFV.

ASSIGN (v_string) TO <wa>.

IF <wa> IS ASSIGNED.

w_CAUFV = <wa>.

concatenate w_CAUFV-KDAUF w_CAUFV-KDPOS into v_name.

condense v_name.

v_id = 'ZATI'.

v_lang = sy-langu.

v_thd = 'VBBP'.

CALL FUNCTION 'READ_TEXT'

EXPORTING

CLIENT = SY-MANDT

id = v_id

language = v_lang

name = v_name

object = v_thd

tables

lines = TI_LINE

EXCEPTIONS

ID = 1

LANGUAGE = 2

NAME = 3

NOT_FOUND = 4

OBJECT = 5

REFERENCE_CHECK = 6

WRONG_ACCESS_TO_ARCHIVE = 7

OTHERS = 8 .

IF sy-subrc = 0.

clear v_key.

v_key = v_name.

LOOP AT TI_LINE.

clear v_text1.

at first.

NODE_I-NODE_KEY = v_key.

NODE_i-isfolder = 'X'.

node_i-text = v_key.

append NODE_i to NODE_TABLE_I.

clear node_i.

ENDAT.

concatenate vi_text v_cnt into v_text1.

condense v_text1.

NODE_I-NODE_KEY = v_text1.

NODE_I-RELATKEY = v_key.

NODE_I-TEXT = v_text1.

append NODE_I to NODE_TABLE_I.

CLEAR NODE_I.

v_cnt = v_cnt + 1.

ENDLOOP.

call method g_tree->add_nodes

exporting

NODE_TABLE = NODE_TABLE_I.

  • expand the root node

CALL METHOD g_tree->expand_node

EXPORTING

node_key = v_key

EXCEPTIONS

node_not_found = 1.

IF sy-subrc <> 0.

  • MESSAGE a001.

ENDIF.

ENDIF.

I think this will be helpful..

Read only

0 Likes
502

I found it !

It´s the option in the fieldcatalogue.

Thx,

Gordon