05-09-2007 7:20 AM
Hi All,
Can anyone send me the code for <b>Deselect all</b> checkboxes in tree Alv.
Thnaks,
Neeraj.
05-09-2007 8:42 AM
Hi Neeraj
I have implemented the same thing recentlly
I tried a lot to find atleast one method to deselect checkboxs in tree structure (cl_gui_alv_tree)
but there is no special method to uncheck/check checkboxes.
ya there are methods to select node/leaf- but I guess this is not what u want.
U can only use change_node method of class :cl_gui_alv_tree,
refer this code :-
DATA : lt_layout_chk_edit TYPE lvc_t_laci,
lt_layout_chk_noedit TYPE lvc_t_laci,
lt_layout_nochk_edit TYPE lvc_t_laci,
lt_layout_nochk_noedit TYPE lvc_t_laci.
********************************
CLEAR ls_layout.
filling layout for package (EDITABLE AND CHECKED)
ls_layout-fieldname = gref_tree_manual->c_hierarchy_column_name.
ls_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_layout-editable = gc_charx.
ls_layout-disabled = ' '.
ls_layout-chosen = gc_charx.
ls_layout-u_disabled = gc_charx.
ls_layout-u_editable = gc_charx.
ls_layout-u_chosen = gc_charx.
APPEND ls_layout TO lt_layout_chk_edit.
CLEAR ls_layout.
filling layout for package (NONEDITABLE AND CHECKED)
ls_layout-fieldname = gref_tree_manual->c_hierarchy_column_name.
ls_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_layout-editable = ' '.
ls_layout-disabled = gc_charx.
ls_layout-chosen = gc_charx.
ls_layout-u_disabled = gc_charx.
ls_layout-u_editable = gc_charx.
ls_layout-u_chosen = gc_charx.
APPEND ls_layout TO lt_layout_chk_noedit.
CLEAR ls_layout.
filling layout for package (EDITABLE AND NON-CHECKED)
ls_layout-fieldname = gref_tree_manual->c_hierarchy_column_name.
ls_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_layout-editable = gc_charx.
ls_layout-disabled = ' '.
ls_layout-chosen = ' '.
ls_layout-u_disabled = gc_charx.
ls_layout-u_editable = gc_charx.
ls_layout-u_chosen = gc_charx.
APPEND ls_layout TO lt_layout_nochk_edit.
CLEAR ls_layout.
filling layout for package display(NONEDITABLE AND NON-CHECKED)
ls_layout-fieldname = gref_tree_manual->c_hierarchy_column_name.
ls_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_layout-editable = ' '.
ls_layout-disabled = gc_charx.
ls_layout-chosen = ' '.
ls_layout-u_disabled = gc_charx.
ls_layout-u_editable = gc_charx.
ls_layout-u_chosen = gc_charx.
APPEND ls_layout TO lt_layout_nochk_noedit.
*******************************
loop at your tree table - which contains all the nodes- for which u want to change the checkbox status (parent/child anything)
this will give u rough idea.....
LOOP AT gt_nodes INTO ls_nodes.
CLEAR ls_outtab.
CALL METHOD gref_tree->get_outtab_line
EXPORTING
i_node_key = ls_nodes-node_key
IMPORTING
e_outtab_line = ls_outtab
EXCEPTIONS
node_not_found = 1
OTHERS = 2.
to make check box (EDITABLE AND NON-CHECKED)
CALL METHOD gref_tree_alacarte-><b>change_node</b>
EXPORTING
i_node_key = ls_nodes-node_key
i_outtab_line = ls_outtab
it_item_layout = lt_layout_nochk_edit
EXCEPTIONS
node_not_found = 1
OTHERS = 2.
endloop.
neeraj, i think this will help u a lot.
Reward if it is helpfull.
regards,
Mihir Nagar.
05-09-2007 8:00 AM
05-09-2007 8:12 AM
Hi Uwe Schieferstein ,
First of all thanks!!!! Good Code .. but my requirment is how to implement the <b>deselect all Checkbox</b> functionality in tree.. I already implemented select all ...
Please reply soon..
Thanks,
Neeraj.
05-09-2007 8:42 AM
Hi Neeraj
I have implemented the same thing recentlly
I tried a lot to find atleast one method to deselect checkboxs in tree structure (cl_gui_alv_tree)
but there is no special method to uncheck/check checkboxes.
ya there are methods to select node/leaf- but I guess this is not what u want.
U can only use change_node method of class :cl_gui_alv_tree,
refer this code :-
DATA : lt_layout_chk_edit TYPE lvc_t_laci,
lt_layout_chk_noedit TYPE lvc_t_laci,
lt_layout_nochk_edit TYPE lvc_t_laci,
lt_layout_nochk_noedit TYPE lvc_t_laci.
********************************
CLEAR ls_layout.
filling layout for package (EDITABLE AND CHECKED)
ls_layout-fieldname = gref_tree_manual->c_hierarchy_column_name.
ls_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_layout-editable = gc_charx.
ls_layout-disabled = ' '.
ls_layout-chosen = gc_charx.
ls_layout-u_disabled = gc_charx.
ls_layout-u_editable = gc_charx.
ls_layout-u_chosen = gc_charx.
APPEND ls_layout TO lt_layout_chk_edit.
CLEAR ls_layout.
filling layout for package (NONEDITABLE AND CHECKED)
ls_layout-fieldname = gref_tree_manual->c_hierarchy_column_name.
ls_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_layout-editable = ' '.
ls_layout-disabled = gc_charx.
ls_layout-chosen = gc_charx.
ls_layout-u_disabled = gc_charx.
ls_layout-u_editable = gc_charx.
ls_layout-u_chosen = gc_charx.
APPEND ls_layout TO lt_layout_chk_noedit.
CLEAR ls_layout.
filling layout for package (EDITABLE AND NON-CHECKED)
ls_layout-fieldname = gref_tree_manual->c_hierarchy_column_name.
ls_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_layout-editable = gc_charx.
ls_layout-disabled = ' '.
ls_layout-chosen = ' '.
ls_layout-u_disabled = gc_charx.
ls_layout-u_editable = gc_charx.
ls_layout-u_chosen = gc_charx.
APPEND ls_layout TO lt_layout_nochk_edit.
CLEAR ls_layout.
filling layout for package display(NONEDITABLE AND NON-CHECKED)
ls_layout-fieldname = gref_tree_manual->c_hierarchy_column_name.
ls_layout-class = cl_gui_column_tree=>item_class_checkbox.
ls_layout-editable = ' '.
ls_layout-disabled = gc_charx.
ls_layout-chosen = ' '.
ls_layout-u_disabled = gc_charx.
ls_layout-u_editable = gc_charx.
ls_layout-u_chosen = gc_charx.
APPEND ls_layout TO lt_layout_nochk_noedit.
*******************************
loop at your tree table - which contains all the nodes- for which u want to change the checkbox status (parent/child anything)
this will give u rough idea.....
LOOP AT gt_nodes INTO ls_nodes.
CLEAR ls_outtab.
CALL METHOD gref_tree->get_outtab_line
EXPORTING
i_node_key = ls_nodes-node_key
IMPORTING
e_outtab_line = ls_outtab
EXCEPTIONS
node_not_found = 1
OTHERS = 2.
to make check box (EDITABLE AND NON-CHECKED)
CALL METHOD gref_tree_alacarte-><b>change_node</b>
EXPORTING
i_node_key = ls_nodes-node_key
i_outtab_line = ls_outtab
it_item_layout = lt_layout_nochk_edit
EXCEPTIONS
node_not_found = 1
OTHERS = 2.
endloop.
neeraj, i think this will help u a lot.
Reward if it is helpfull.
regards,
Mihir Nagar.