Skip to Content
0
Former Member
Nov 30, 2011 at 08:47 PM

ALV Tree - Insert Icon into columns

2095 Views

Hi all,

I've a problem with ALV TREE.

I want insert a icon symbol into colum but when execute the program the output is '@09@'.

How I can resolve the problem?

I use this code :

FORM display_alv_tree.
DATA: lv_no_parent TYPE salv_de_node_key,
lt_table TYPE zdemo_recursive_tree_t OCCURS 0,
lo_nodes TYPE REF TO cl_salv_nodes,
lo_settings TYPE REF TO cl_salv_tree_settings,
lo_columns TYPE REF TO cl_salv_columns,
lo_column TYPE REF TO cl_salv_column,
lo_column_tree TYPE REF TO cl_salv_column_tree.
FIELD-SYMBOLS: <node> TYPE zdemo_recursive_tree_t.
* Instantiate the ALV tree object
TRY.
CALL METHOD cl_salv_tree=>factory
IMPORTING
r_salv_tree = go_alv_tree
CHANGING
t_table = lt_table.
CATCH cx_root.
* Exception handling omitted
ENDTRY.
* Build the ALV tree, starting with the top-level tree node
READ TABLE gt_tree_structure ASSIGNING <node>
WITH KEY identifier = 'TOTAL CHAIN' .
* identifier = p_pspid.
IF sy-subrc IS INITIAL.
* This recursive subroutine builds the entire ALV tree
PERFORM draw_tree
USING lv_no_parent " intentionally blank parent node
<node>.
ENDIF.
* Set some display settings for the ALV tree
lo_settings = go_alv_tree->get_tree_settings( ).
lo_settings->set_hierarchy_header( 'Chain Structure' ).
lo_settings->set_hierarchy_size( 80 ).
* lo_settings->SET_HIERARCHY_ICON( 'ICON_LIGHT' ).
lo_nodes = go_alv_tree->get_nodes( ).
* lo_nodes->expand_all( ).
 
* Hide any columns we don't want shown in the ALV tree
TRY.
lo_columns = go_alv_tree->get_columns( ).
lo_column = lo_columns->get_column( 'OBJECT' ).
lo_column->set_technical( if_salv_c_bool_sap=>true ).
lo_column = lo_columns->get_column( 'DESCRIPTION' ).
lo_column->set_technical( if_salv_c_bool_sap=>true ).
lo_column = lo_columns->get_column( 'PARENT' ).
lo_column->set_technical( if_salv_c_bool_sap=>true ).
lo_column = lo_columns->get_column( 'ICON' ).
lo_column->set_technical( if_salv_c_bool_sap=>true ).
lo_column = lo_columns->get_column( 'STATUS' ).
lo_column->set_technical( if_salv_c_bool_sap=>true ).
lo_column = lo_columns->get_column( 'STARTTIMESTAMP' ).
lo_column->set_technical( if_salv_c_bool_sap=>true ).
lo_column = lo_columns->get_column( 'ENDTIMESTAMP' ).
lo_column->set_technical( if_salv_c_bool_sap=>true ).
lo_column = lo_columns->get_column( 'IDENTIFIER' ).
lo_column->set_technical( if_salv_c_bool_sap=>true ).
lo_column = lo_columns->get_column( 'START_TIME' ).
lo_column->SET_OPTIMIZED( if_salv_c_bool_sap=>true ).
* lo_column_tree = lo_columns->get_column( 'ICON_LIGHT' ).
* lo_column_tree = GET_COLUMNNAME( 'ICON_LIGHT' ).
data : pippo type c.
pippo = lo_column_tree->IS_ICON( ).
 
CATCH cx_root.
* Exception handling omitted
ENDTRY.
* Display the ALV tree

go_alv_tree->display( ).


ENDFORM. " DISPLAY_ALV_TREE

Thanks

Please use code tags.

Edited by: Rob Burbank on Nov 30, 2011 3:57 PM