02-10-2009 5:50 PM
Hi experts,
i have a small problem in alv tree report using classes,
my reequirement is i have to display the list of fields in tree, the tree is fine, but i want to add a code i,e. when i double click on the child node in a node, it should go to a transaction code (FAGL03) with selection screen variables as input to the transaction. can any one help me in this aspect , as i have tried and searched for similar threads , i didnt found any.
i have to select only the single last childs (GL Account) in the parent node, so that it leads to the TRANSACTION for GL display.*******
Regards,
venkat
02-10-2009 10:26 PM
Hi,
it's similar to ALV grid. You need to define event for double click and create handler for this event.
* Code responsible for setting event
CALL METHOD tree1->get_registered_events
IMPORTING
events = lt_events.
l_event-eventid = cl_gui_column_tree=>eventid_node_double_click.
APPEND l_event TO lt_events.
CALL METHOD tree1->set_registered_events
EXPORTING
events = lt_events
EXCEPTIONS
cntl_error = 1
cntl_system_error = 2
illegal_event_combination = 3.
IF sy-subrc <> 0.
MESSAGE e208(00) WITH 'ERROR'. "#EC NOTEXT
ENDIF.
* set Handler
CREATE OBJECT l_event_receiver.
SET HANDLER l_event_receiver->handle_node_double_click FOR tree1.
Here is the example of handler implementation.
* Handler definition
CLASS lcl_tree_event_receiver DEFINITION.
PUBLIC SECTION.
METHODS handle_node_double_click
FOR EVENT node_double_click OF cl_gui_alv_tree
IMPORTING node_key sender.
ENDCLASS. "lcl_tree_event_receiver DEFINITION
* Handler implementation
CLASS lcl_tree_event_receiver IMPLEMENTATION.
METHOD handle_node_double_click.
CALL METHOD sender->get_outtab_line
EXPORTING
i_node_key = node_key
IMPORTING
e_outtab_line = gs_idoc_s
EXCEPTIONS
node_not_found = 1
OTHERS = 2.
IF sy-subrc <> 0.
MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
ENDIF.
* Logic behind double click
ENDMETHOD. "handle_node_double_click
Cheers
02-11-2009 4:29 AM
hi martin,
thanks for the answer, it was very helpfull. but is there any option to get the selection screen variables to implement in the method, i,e.. i want my input variables to be the inputs for the called transaction after the double click.
Thanks & regards,
Venkat
02-11-2009 4:56 AM
Hi,
method get_outtab_line returns line which corresponds to double clicked line. There you will have all values which you need.
Cheers
02-24-2009 10:50 AM