2006 Feb 22 11:27 AM
Hi ,
I am using CL_GUI_LIST_TREE to display my tree, here i've a problem in the left pane we have option to expand /collapse .i'm able to capture the event for expansion, but i'm unable to find the event for collapse.
(left side <| click for expand/collapse).what is the event for collapse? if any one have any idea please let me know..
Regards
Vijay
Hi ,
I am using CL_GUI_LIST_TREE to display my tree, here i've a problem in the left pane we have option to expand /collapse .i'm able to capture the event for expansion, but i'm unable to find the event for collapse.
(left side <| click for expand/collapse).what is the event for collapse? if any one have any idea please let me know..
Regards
Vijay
2006 Feb 22 11:36 AM
Hi Vijay,
The super class of CL_GUI_LIST_TREE ,
CL_ITEM_TREE_CONTROL has some methods for collapse
I hope this will help.
Regards,
GSR.
2006 Feb 22 11:42 AM
Hi Srinivas,
i'know that, in cl_gui_list_tree it self i have a mthod for collapse. but the problem here is i want te event which fires after you click on collapse.
i hope it is clear...
Regards
vijay
2006 Feb 22 11:53 AM
Hi kulkarni,
yea for expansion i've used the same event, but that is not triggering for collapse,
are you able to make it tirgger for both.please let me know..
Regards
vijay
2006 Feb 22 12:10 PM
Hello,
set handler me->handle_expand_nc
set handler me->handle_node_double_click
set handler me->handle_node_context_menu_rq
set handler me->handle_node_context_menu_sel
set handler me->handle_item_double_click
set handler me->handle_item_context_menu_rq
set handler me->handle_item_context_menu_sel
<b>set handler me->handle_selection_changed</b>
set handler me->handle_button_click
set handler me->handle_link_click
set handler me->handle_header_click
set handler me->handle_checkbox_change
set handler me->handle_item_keypress
set handler me->handle_node_keypress
set handler me->handle_on_drag
set handler me->handle_on_drop
set handler me->handle_on_drag_multiple
set handler me->handle_on_drop_complete
set handler me->handle_on_drop_complete_mult
set handler me->handle_on_drop_get_flavorThese are the handlers events that you can use in tree i do not see one for collapse however there exists a method
COLLAPSE_SUBTREE will try to use it and see if by this if is possible in some way to do something when the subtree collapses.
Regards,
Shekhar Kulkarni
2006 Feb 22 12:19 PM
Hi,
i used all of the above events for different things, i could not able to find it for collapse, yes i know collapse_subtree method,but
when can i call this method..., where can i call this method if there no event related.
any way thanks for your response.
Regards
vijay
Message was edited by: Vijay Babu Dudla
2008 Jun 03 2:05 PM
sorry for my english. try this... it works but the EXPAND method is not the best one
CLASS cl_tree_event_receiver DEFINITION.
PUBLIC SECTION.
double click item
METHODS handle_double_click
FOR EVENT node_double_click OF cl_gui_alv_tree
IMPORTING node_key.
Drag
METHODS handle_on_drag
FOR EVENT on_drag OF cl_gui_alv_tree
IMPORTING drag_drop_object
fieldname
node_key.
METHODS on_before_user_command
FOR EVENT before_user_command OF cl_gui_alv_tree
IMPORTING ucomm.
METHODS on_after_user_command
FOR EVENT after_user_command OF cl_gui_alv_tree
IMPORTING ucomm.
PRIVATE SECTION.
ENDCLASS. "CL_TREE_EVENT_RECEIVER DEFINITION
----
CLASS CL_TREE_EVENT_RECEIVER IMPLEMENTATION
----
CLASS cl_tree_event_receiver IMPLEMENTATION.
handle double_click
METHOD handle_double_click.
CHECK NOT node_key IS INITIAL.
PERFORM display_ss_log USING node_key.
PERFORM display_bkpf_infos USING node_key.
ENDMETHOD. "HANDLE_DOUBLE_CLICK
Drag & Drop
METHOD handle_on_drag.
CHECK NOT node_key IS INITIAL.
PERFORM display_ss_log USING node_key.
CALL METHOD cl_gui_cfw=>set_new_ok_code
EXPORTING
new_code = fcode_entr.
ENDMETHOD. "HANDLE_ON_DRAG
METHOD on_before_user_command.
DATA: l_selected_parent TYPE lvc_nkey.
DATA: l_selected_node TYPE lvc_nkey.
DATA: l_selected_nodes TYPE lvc_t_nkey.
DATA: w_lines TYPE i.
DATA: l_key type lvc_nkey.
MESSAGE i000(0k) WITH text-e18 ucomm.
CASE ucomm.
WHEN '&COLLAPSE'.
CALL METHOD tree1->collapse_all_nodes.
WHEN '&EXPAND'.
CALL METHOD tree1->get_selected_item
IMPORTING
e_selected_node = l_selected_node
EXCEPTIONS
no_item_selection = 1
cntl_system_error = 2
failed = 3
OTHERS = 4.
IF sy-subrc <> 0.
CALL METHOD tree1->get_top_node
IMPORTING
e_node_key = l_selected_node.
ENDIF.
APPEND l_selected_node TO l_selected_nodes.
CALL METHOD tree1->expand_nodes
EXPORTING
it_node_key = l_selected_nodes.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "on_before_user_command
METHOD on_after_user_command.
MESSAGE i000(0k) WITH text-e20 ucomm.
CASE ucomm.
WHEN '&COLLAPSE'.
CALL METHOD tree1->collapse_all_nodes.
WHEN '&EXPAND'.
WHEN OTHERS.
ENDCASE.
ENDMETHOD. "on_after_user_command
ENDCLASS. "CL_TREE_EVENT_RECEIVER IMPLEMENTATION
*
DATA: tree_event_receiver TYPE REF TO cl_tree_event_receiver.
2006 Feb 22 11:36 AM
Hi,
Look at the link may be you will find some thing.
http://www.sapdevelopment.co.uk/reporting/alv/alvtree.htm
Thanks.
If this helps you reward with points.
2006 Feb 22 11:44 AM
Hello,
lv_tree
exporting
parent = g_custom_container
node_selection_mode = cl_gui_column_tree=>node_sel_mode_single
item_selection = 'X'
no_html_header = ''
no_toolbar = ''
exceptions
cntl_error = 1
cntl_system_error = 2
create_error = 3
lifetime_error = 4
illegal_node_selection_mode = 5
failed = 6
illegal_column_name = 7.
perform build_hierarchy_header changing l_hierarchy_header.
p_logo = 'Your Logo'.
perform f_build_comment changing is_header
it_header.
is_variant-report = sy-repid.
is_variant-log_group = 'LIST'.
call method g_alv_tree->set_table_for_first_display
exporting
i_structure_name = 'Y1MM_IMAC010_ALV'
is_variant = is_variant
i_save = 'A'
is_hierarchy_header = l_hierarchy_header
it_list_commentary = it_header
i_logo = p_logo
i_background_id = 'ALV_BACKGROUND'
changing
it_outtab = i_out_tree.
* §4. Create hierarchy (nodes and leaves)
perform create_hierarchy.
* §5. Send data to frontend.
call method g_alv_tree->frontend_update.
* Events registering for double click event
perform f_register_events.
form f_register_events.
* Event registration: tell ALV Tree which events shall be passed
* from frontend to backend.
data: lt_events type cntl_simple_events,
l_event type cntl_simple_event,
l_event_receiver type ref to lcl_tree_event_receiver.
* l_tb_event_receiver type ref to toolbar_event_receiver.
* l_dnd_event_receiver TYPE REF TO lcl_dnd_event_receiver.
* Register additional events for your own purposes:
* §Remark: you do not need to register dnd events on frontend
* Note 648983: Register double click event in any case!
* If parameter NO_CALL_TA is set 'X' (e.g. when called from
* batch information cockpit) double click on an BWU elemet results
* in calling the respective transaction starting a new task.
* If parameter NO_CALL_TA is initial, transactions will be displayed
* in the same mode as the batch-where-used list.
call method g_alv_tree->get_registered_events
importing events = lt_events.
* Frontend registration(ii): add additional event ids
l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
append l_event to lt_events.
* Frontend registration(iii):provide new event table to alv tree
call method g_alv_tree->set_registered_events
exporting
events = lt_events
exceptions
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
if sy-subrc <> 0.
* Fehler in der Control-Verarbeitung! (&)
message s300(12) with 'ERROR'.
endif.
* Register events on backend (ABAP Objects event handling)
create object l_event_receiver.
set handler l_event_receiver->handle_item_double_click
for g_alv_tree.
endform. " f_register_events.
In the data declaration
CLASS lcl_tree_event_receiver DEFINITION.
PUBLIC SECTION.
* Define an event handler method for each event you want to react to.
METHODS handle_item_double_click
FOR EVENT item_double_click OF cl_gui_alv_tree
IMPORTING node_key fieldname sender.
* 'sender' is an implicit event parameter that is provided by
* ABAP Objects runtime system. It contains a reference to the
* object that fired the event. You may directly use it to
* call methods of this instance.
ENDCLASS.
*******************************************************************
CLASS lcl_tree_event_receiver IMPLEMENTATION.
* Implement your event handler methods.
METHOD handle_item_double_click.
PERFORM f_show_dclick USING node_key fieldname.
ENDMETHOD.
ENDCLASS.here i have defined for double click you need to define for expand/collapse that.. is
METHOD HANDLE_EXPAND_NC.
this should solve your problem.
Regards,
Shekhar Kulkarni
2008 Jul 17 6:36 AM
2010 Apr 21 7:35 AM
Hi Vijay,
how did you solve the problem. I have the same problem an I don't know how to work around.
Thank you.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |