02-02-2007 3:38 AM
Dear all,
Now I am programming a report which should use ALV tree to display some hierarchical information. In order to make it more intuitionistic to be read, I want to set relevant icons for some nodes in hierarch item of the tree. But, I found some problem as follows:
1. I have set a icon for the node's hierarchy item, but it can't be display while running the report.
2. Some nodes' icons are displayed, but it exists a folder icon in front of the user defined icon. How can I hide this folder icon?
In addition, I found that only the short text for column is displayed despite I have set long, medium and short text for relevant column already. I don't know where is the problem.
It's very urgent for me! Looking forward to receiving your helps!
Thanks,
Justin - Xiongjunwen
02-02-2007 4:25 AM
Hello Justin
For displaying user-defined icons instead of the folder icons I modified the sample report SALV_DEMO_TREE_FUNCTIONS as following:
*&---------------------------------------------------------------------*
*& Report SALV_DEMO_TREE_FUNCTIONS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZUS_SDN_SALV_DEMO_TREE_FUNC_1.
type-pools: icon.
constants:
gc_icon_detail type SALV_DE_TREE_IMAGE value '@3R@',
gc_icon_overview type SALV_DE_TREE_IMAGE value '@3Q@'.
...
*&---------------------------------------------------------------------*
*& Form add_carrid_line
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LS_DATA text
* -->P_0516 text
* <--P_L_CARRID_KEY text
*----------------------------------------------------------------------*
FORM add_carrid_line USING P_LS_DATA type alv_t_t2
p_key
CHANGING P_L_CARRID_KEY.
data: nodes type ref to cl_salv_nodes,
node type ref to cl_salv_node,
text type lvc_value.
*... §0 working with nodes
nodes = gr_tree->get_nodes( ).
try.
* ... §0.1 add a new node
** node = nodes->add_node( related_node = p_key
** relationship = cl_gui_column_tree=>relat_last_child ).
node = nodes->add_node( related_node = p_key
relationship = cl_gui_column_tree=>relat_last_child
collapsed_icon = gc_icon_overview
expanded_icon = gc_icon_detail ).
* ... §0.2 if information should be displayed at
* the hierarchy column set the carrid as text for this node
text = p_ls_data-carrid.
node->set_text( text ).
* ... §0.3 set the data for the nes node
node->set_data_row( p_ls_data ).
P_L_CARRID_KEY = node->get_key( ).
catch cx_salv_msg.
endtry.
ENDFORM. " add_carrid_line
Regards
Uwe
02-02-2007 4:25 AM
Hello Justin
For displaying user-defined icons instead of the folder icons I modified the sample report SALV_DEMO_TREE_FUNCTIONS as following:
*&---------------------------------------------------------------------*
*& Report SALV_DEMO_TREE_FUNCTIONS
*&
*&---------------------------------------------------------------------*
*&
*&
*&---------------------------------------------------------------------*
REPORT ZUS_SDN_SALV_DEMO_TREE_FUNC_1.
type-pools: icon.
constants:
gc_icon_detail type SALV_DE_TREE_IMAGE value '@3R@',
gc_icon_overview type SALV_DE_TREE_IMAGE value '@3Q@'.
...
*&---------------------------------------------------------------------*
*& Form add_carrid_line
*&---------------------------------------------------------------------*
* text
*----------------------------------------------------------------------*
* -->P_LS_DATA text
* -->P_0516 text
* <--P_L_CARRID_KEY text
*----------------------------------------------------------------------*
FORM add_carrid_line USING P_LS_DATA type alv_t_t2
p_key
CHANGING P_L_CARRID_KEY.
data: nodes type ref to cl_salv_nodes,
node type ref to cl_salv_node,
text type lvc_value.
*... §0 working with nodes
nodes = gr_tree->get_nodes( ).
try.
* ... §0.1 add a new node
** node = nodes->add_node( related_node = p_key
** relationship = cl_gui_column_tree=>relat_last_child ).
node = nodes->add_node( related_node = p_key
relationship = cl_gui_column_tree=>relat_last_child
collapsed_icon = gc_icon_overview
expanded_icon = gc_icon_detail ).
* ... §0.2 if information should be displayed at
* the hierarchy column set the carrid as text for this node
text = p_ls_data-carrid.
node->set_text( text ).
* ... §0.3 set the data for the nes node
node->set_data_row( p_ls_data ).
P_L_CARRID_KEY = node->get_key( ).
catch cx_salv_msg.
endtry.
ENDFORM. " add_carrid_line
Regards
Uwe
02-02-2007 4:26 AM
Hello Justin
Forgot to mention that you can use report <b>RSTXICON</b> to get a list of the icons and their codes.
Regards
Uwe
02-02-2007 6:40 AM
Hello Uwe,
Thanks for your help! Now, I can set tree icon as my wishes.
Regards,
Justin
02-02-2007 4:33 AM
Hello Justin
In order to modify the column texts (long, medium) you have to do the following (see routine <b>SET_COLUMNS_TECHNICAL</b> in sample report <b>SALV_DEMO_TREE_FUNCTIONS</b>) :
data:
lo_columns type ref to cl_salv_columns,
lo_column type ref to cl_salv_column.
lo_columns = gr_tree->get_columns( ).
lo_column = lo_columns->get_column( <your column name> ).
lo_column->set_long_text( <your long text> ).
lo_column->set_medium_text( <your medium text> ).
Regards
Uwe