Skip to Content
0
Former Member
Dec 07, 2006 at 12:01 PM

displaying icons in tree view control

121 Views

Hi all

i am trying to display icons in my tree view control.I am using beow code but i am not getting the ouput.Please help me.

Type-pools : fibs,stree , ICON.

data : t_node type snodetext.

data : node_tab like t_node occurs 0 with header line,

it_icon_id type icon-id.

clear : node_tab, node_tab[].

select single id from icon into it_icon_id

where name = 'ICON_CUSTOMER'.

node_tab-type = 'T'.

node_tab-name = 'Earth'.

node_tab-tlevel = '01'.

node_tab-nlength = '5'.

node_tab-color = '4'.

node_tab-text = 'Hello'.

node_tab-tlength ='5'.

node_tab-tcolor = 3.

node_tab-NODEICON = it_icon_id.

append node_tab.

clear node_tab.

node_tab-type = 'P'.

node_tab-name = 'Europe'.

node_tab-tlevel = '02'.

node_tab-nlength = '6'.

node_tab-color = '1'.

node_tab-text = 'Hello'.

node_tab-tlength ='5'.

node_tab-tcolor = 4.

node_tab-NODEICON = it_icon_id.

append node_tab.

clear node_tab.

CALL FUNCTION 'RS_TREE_CONSTRUCT'

  • EXPORTING

  • INSERT_ID = '000000'

  • RELATIONSHIP = ' '

  • LOG =

TABLES

NODETAB = node_tab

  • EXCEPTIONS

  • TREE_FAILURE = 1

  • ID_NOT_FOUND = 2

  • WRONG_RELATIONSHIP = 3

  • OTHERS = 4

.

IF SY-SUBRC <> 0.

  • MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO

  • WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.

ENDIF.

DATA: type_mapping TYPE stree_ctl_type_mapping_tab.

DATA: wa_type TYPE stree_ctl_type_mapping.

CLEAR: type_mapping[].

wa_type-type = 'A'.

wa_type-icon = '@A0@'.

APPEND wa_type TO type_mapping.

CALL FUNCTION 'RS_TREE_CONTROL_PREPARE'

EXPORTING

CONTROL_PATTERN = 'PH'

MULTIPLE_SELECTION = 'X'

TYPE_MAPPING = type_mapping.

CALL FUNCTION 'RS_TREE_LIST_DISPLAY'

EXPORTING

LAYOUT_MODE = ' '

USE_CONTROL = STREE_USE_LIST.

Thank you.

Regards

Giri.