Skip to Content
author's profile photo Former Member
Former Member

ALV Tree Double Click Functionality

I'm using an ALV tree grid to display a bunch of document headers and I'd like to add functionality when one such row is double clicked that a popup details window opens with additional data, preferably a grid like view of line items. Does anyone have input on how to use method handle_item_double_click to accommodate such a request?

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jul 31, 2008 at 04:31 AM

    Hi,

    Try the below example program in SE38.

    BCALV_GRID_DND_TREE ALV Grid: Drag and Drop with ALV Tree

    BCALV_GRID_DND_TREE_SIMPLE ALV GRID: Drag and drop with ALV tree (simple)

    BCALV_TEST_COLUMN_TREE Program BCALV_TEST_COLUMN_TREE

    BCALV_TEST_SIMPLE_TREE Program BCALV_TEST_SIMPLE_TREE

    BCALV_TREE_01 ALV Tree Control: Build Up the Hierarchy Tree

    BCALV_TREE_02 ALV Tree Control: Event Handling

    BCALV_TREE_03 ALV Tree Control: Use an Own Context Menu

    BCALV_TREE_04 ALV Tree Control: Add a Button to the Toolbar

    BCALV_TREE_05 ALV Tree Control: Add a Menu to the Toolbar

    BCALV_TREE_06 ALV tree control: Icon column and icon for nodes/it

    BCALV_TREE_DEMO Demo for ALV tree control

    BCALV_TREE_DND ALV tree control: Drag & Drop within a hierarchy tr

    BCALV_TREE_DND_MULTIPLE ALV tree control: Drag & Drop within a hierarchy tr

    BCALV_TREE_EVENT_RECEIVER Include BCALV_TREE_EVENT_RECEIVER

    BCALV_TREE_EVENT_RECEIVER01

    BCALV_TREE_ITEMLAYOUT ALV Tree: Change Item Layouts at Runtime

    BCALV_TREE_MOVE_NODE_TEST Demo for ALV tree control

    BCALV_TREE_SIMPLE_DEMO Program BCALV_TREE_SIMPLE_DEMO

    BCALV_TREE_VERIFY Verifier for ALV Tree and Simple ALV Tree

    Regards,

    Boobalan S

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 31, 2008 at 04:28 AM

    Hi,

    check with sap standard program.

    1.BCALV_TREE_02

    2.BCALV_TREE_EVENT_RECEIVER

    3.BCALV_TREE_EVENT_RECEIVER01

    thanks,

    Sendil

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 31, 2008 at 04:32 AM

    Hi

    In order to add additional buttons onto the ALVtree report the following sections of code need

    implementing:

    Creation of tree event reciever class

    Define class to handle user interaction other than via toolbar buttons. Insert at end of DATA declaration

    section but before any ABAP processing.

    ----


    • INCLUDE BCALV_TREE_EVENT_RECEIVER *

    ----


    CLASS lcl_tree_event_receiver DEFINITION.

    PUBLIC SECTION.

    METHODS handle_node_ctmenu_request

    FOR EVENT node_context_menu_request OF cl_gui_alv_tree

    IMPORTING node_key

    menu.

    METHODS handle_node_ctmenu_selected

    FOR EVENT node_context_menu_selected OF cl_gui_alv_tree

    IMPORTING node_key

    fcode.

    METHODS handle_item_ctmenu_request

    FOR EVENT item_context_menu_request OF cl_gui_alv_tree

    IMPORTING node_key

    fieldname

    menu.

    METHODS handle_item_ctmenu_selected

    FOR EVENT item_context_menu_selected OF cl_gui_alv_tree

    IMPORTING node_key

    fieldname

    fcode.

    METHODS handle_item_double_click

    FOR EVENT item_double_click OF cl_gui_alv_tree

    IMPORTING node_key

    fieldname.

    METHODS handle_button_click

    FOR EVENT button_click OF cl_gui_alv_tree

    IMPORTING node_key

    fieldname.

    METHODS handle_link_click

    FOR EVENT link_click OF cl_gui_alv_tree

    IMPORTING node_key

    fieldname.

    METHODS handle_header_click

    FOR EVENT header_click OF cl_gui_alv_tree

    IMPORTING fieldname.

    ENDCLASS.

    ----


    • CLASS lcl_tree_event_receiver IMPLEMENTATION

    ----


    • ........ *

    ----


    CLASS lcl_tree_event_receiver IMPLEMENTATION.

    METHOD handle_node_ctmenu_request.

    • append own functions

    CALL METHOD menu->add_function

    EXPORTING fcode = 'USER1'

    text = 'Usercmd 1'. "#EC NOTEXT

    CALL METHOD menu->add_function

    EXPORTING fcode = 'USER2'

    text = 'Usercmd 2'. "#EC NOTEXT

    CALL METHOD menu->add_function

    EXPORTING fcode = 'USER3'

    text = 'Usercmd 3'. "#EC NOTEXT

    ENDMETHOD.

    METHOD handle_node_ctmenu_selected.

    CASE fcode.

    WHEN 'USER1' OR 'USER2' OR 'USER3'.

    MESSAGE i000(0h) WITH 'Node-Context-Menu on Node ' node_key

    'fcode : ' fcode. "#EC NOTEXT

    ENDCASE.

    ENDMETHOD.

    METHOD handle_item_ctmenu_request .

    • append own functions

    CALL METHOD menu->add_function

    EXPORTING fcode = 'USER1'

    text = 'Usercmd 1'.

    CALL METHOD menu->add_function

    EXPORTING fcode = 'USER2'

    text = 'Usercmd 2'.

    CALL METHOD menu->add_function

    EXPORTING fcode = 'USER3'

    text = 'Usercmd 3'.

    ENDMETHOD.

    METHOD handle_item_ctmenu_selected.

    CASE fcode.

    WHEN 'USER1' OR 'USER2' OR 'USER3'.

    MESSAGE i000(0h) WITH 'Item-Context-Menu on Node ' node_key

    'Fieldname : ' fieldname. "#EC NOTEXT

    ENDCASE.

    ENDMETHOD.

    METHOD handle_item_double_click.

    • Processing for when user double clicks on ALVtree

    ENDMETHOD.

    METHOD handle_button_click.

    • Processing when user clicks button

    ENDMETHOD.

    METHOD handle_link_click.

    • ??

    ENDMETHOD.

    METHOD handle_header_click.

    • Processing for when user clicks on ALVtree column headers

    ENDMETHOD.

    ENDCLASS.

    Code to activate User interaction events (i.e. double click)

    Insert the following code into the PBO of the screen after the ALVtree has been created.

    i.e after 'CALL METHOD gd_tree->set_table_for_first_display' has been executed.

    &----


    *& REGISTER_EVENTS

    &----


    • define the events which will be passed to the backend

    data: lt_events type cntl_simple_events,

    l_event type cntl_simple_event.

    • define the events which will be passed to the backend

    l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.

    append l_event to lt_events.

    l_event-eventid = cl_gui_column_tree=>eventid_checkbox_change.

    append l_event to lt_events.

    l_event-eventid = cl_gui_column_tree=>eventid_header_context_men_req.

    append l_event to lt_events.

    l_event-eventid = cl_gui_column_tree=>eventid_node_context_menu_req.

    append l_event to lt_events.

    l_event-eventid = cl_gui_column_tree=>eventid_item_context_menu_req.

    append l_event to lt_events.

    l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.

    append l_event to lt_events.

    l_event-eventid = cl_gui_column_tree=>eventid_header_click.

    append l_event to lt_events.

    l_event-eventid = cl_gui_column_tree=>eventid_item_keypress.

    append l_event to lt_events.

    call method gd_tree->set_registered_events

    exporting

    events = lt_events

    exceptions

    cntl_error = 1

    cntl_system_error = 2

    illegal_event_combination = 3.

    if sy-subrc <> 0.

    message x208(00) with 'ERROR'. "#EC NOTEXT

    endif.

    • set Handler

    data: l_event_receiver type ref to lcl_tree_event_receiver.

    create object l_event_receiver.

    set handler l_event_receiver->handle_node_ctmenu_request

    for gd_tree.

    set handler l_event_receiver->handle_node_ctmenu_selected

    for gd_tree.

    set handler l_event_receiver->handle_item_ctmenu_request

    for gd_tree.

    set handler l_event_receiver->handle_item_ctmenu_selected

    for gd_tree.

    set handler l_event_receiver->handle_item_double_click

    for gd_tree.

    set handler l_event_receiver->handle_header_click

    for gd_tree.

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.