ALV Tree - Event Handler

Hi All,
I amd currently developing an ALV tree program to capture the hierarchy of functional location. I managed to display the hierarchy in ALV Tree using cl_gui_column_tree.
Now, i am working on double clicking the functional location and it will bring me to tcode IL03. But, it seems like i cannot capture of the field value clicked. Below are my source code.  Can anyone pls help me on this? Thank you very much
*&      Form  register_events
      text
-->  p1        text
<--  p2        text
FORM 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.
  CALL METHOD gd_tree->get_registered_events
    IMPORTING
      events = lt_events.
  l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
  l_event-appl_event = 'X'.
  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'.
  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_item_double_click FOR gd_tree.
ENDFORM.                    " register_events
CLASS lcl_tree_event_receiver DEFINITION.
  PUBLIC SECTION.
    METHODS handle_item_double_click
      FOR EVENT item_double_click OF cl_gui_alv_tree
      IMPORTING node_key
                fieldname.
ENDCLASS.                    "lcl_tree_event_receiver DEFINITION
CLASS lcl_tree_event_receiver IMPLEMENTATION.
  METHOD handle_item_double_click.
    DATA: lt_selected_nodes TYPE lvc_nkey,
          lt_fieldname      TYPE lvc_fname.
Determine which line is selected
    CALL METHOD gd_tree->get_selected_item
      IMPORTING
        e_selected_node = lt_selected_nodes
        e_fieldname     = lt_fieldname.
    CALL METHOD cl_gui_cfw=>flush.
    SET PARAMETER ID 'IFL' FIELD lt_fieldname.
    SET PARAMETER ID 'ISR' FIELD 'MOB01'.
    CALL TRANSACTION 'IL03' AND SKIP FIRST SCREEN.
  ENDMETHOD.                    "handle_item_double_click
ENDCLASS.                    "lcl_tree_event_receiver IMPLEMENTATION

Hello Goh
Based on your coding you are using CL_GUI_ALV_TREE instead of CL_GUI_COLUMN_TREE.
Calling method get_selected_item within your event handler method is unnecessary because these data are already provided by the event interface.
[code]METHOD handle_item_double_click.
DATA: lt_selected_nodes TYPE lvc_nkey,
lt_fieldname TYPE lvc_fname.
*$Comment: unnecessary because these data are already provided
by the event interface (IMPORTING nodekey fieldname).
Determine which line is selected
**CALL METHOD gd_tree->get_selected_item
**IMPORTING
**e_selected_node = lt_selected_nodes
**e_fieldname = lt_fieldname.
ENDMETHOD. "handle_item_double_click[/code]
The following sample is based in report BCALV_TREE_04 but can be simply applied to your application:
[code]  METHOD handle_item_double_click.
  define local data
    DATA:
      ls_outtab     TYPE sflight.
    FIELD-SYMBOLS:
      <ld_fld>      TYPE ANY.
  Call this method to get the values of the selected tree line
    CALL METHOD g_alv_tree->get_outtab_line
      EXPORTING
        i_node_key     = node_key
      IMPORTING
        e_outtab_line  = ls_outtab
       E_NODE_TEXT    =
       et_item_layout =
       ES_NODE_LAYOUT =
      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.
    ASSIGN COMPONENT fieldname OF STRUCTURE ls_outtab TO <ld_fld>.
    IF ( <ld_fld> IS ASSIGNED ).
  ... Call transaction with selected (item) value.
    ENDIF.
  ENDMETHOD.                    "handle_item_double_click[/code]
The ASSIGN statement will work if no item of the hierarchy part is selected.
Regards
  Uwe

Similar Messages

  • ALV Tree event registration doesn't work

    Hello Experts,
    the following is the registration-form which shall register a item-double-click event to my alv-tree-object. when doing the double-click it doesn't open my own methods in the event-handler class but the standard ones and nothing happens further.
    Any ideas?
    Many thanks in advance!
    Tobias
    FORM register_events.
      DATA: lt_events TYPE cntl_simple_events,
            l_event TYPE cntl_simple_event.
      CALL METHOD g_alv_tree->get_registered_events
        IMPORTING
          events = lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_item_double_click.
      APPEND l_event TO lt_events.
      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.
        MESSAGE x208(00) WITH 'ERROR'.                          "#EC NOTEXT
      ENDIF.
      CREATE OBJECT event_handler.
      SET HANDLER event_handler->handle_item_double_click FOR g_alv_tree.
    ENDFORM.

    It doesn't matter where I place my double-click. The standard event handling "handle_event" is called.
    Instead of this I would like to have my coding.....
    Changing the cl_gui_alv_tree to cl_gui_column_tree doesn't work since my tree isn't a reference of column_tree but of alv_tree. So I would have to rebuild nearly the entire tree. This cannot be a solution since I guess the double-click item should work anyway.
    What I am wondering furthermore is my button declaration not being displayed. The following is my fieldcatalog declaration:
    FORM create_tree_fc.
      DATA: ls_fc TYPE lvc_s_fcat.
      DATA: lo_descrref   TYPE REF TO cl_abap_typedescr.
      DATA: lo_tableref TYPE REF TO cl_abap_tabledescr.
      DATA: lo_structref TYPE REF TO cl_abap_structdescr.
      FIELD-SYMBOLS: <fs_str> TYPE abap_compdescr.
      lo_tableref ?= cl_abap_tabledescr=>describe_by_data( lt_report_tree ).
      lo_descrref ?= lo_tableref->get_table_line_type( ).
      lo_structref ?= lo_descrref.
      CLEAR gt_fc[].
      LOOP AT lo_structref->components ASSIGNING <fs_str>.
        CLEAR ls_fc.
        ls_fc-fieldname = <fs_str>-name.
        ls_fc-intlen = <fs_str>-length.
        ls_fc-inttype = <fs_str>-type_kind.
        ls_fc-decimals = <fs_str>-decimals.
        CASE <fs_str>-name.
          WHEN 'PROCESS_TYPE'.
            ls_fc-tooltip = 'Process Type'.
            ls_fc-coltext = 'Process Type'.
            ls_fc-emphasize = 'C110'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = cl_gui_column_tree=>item_class_button.
            ls_fc-outputlen = 20.
          WHEN 'SMI_PROJECT'.
            ls_fc-tooltip = 'Project Relation'.
            ls_fc-coltext = 'Project'.
            ls_fc-hotspot = 'X'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_DISABLED.
            ls_fc-outputlen = <fs_str>-length.
          WHEN 'TRORDER_NUMBER'.
            ls_fc-tooltip = 'ID of Transport Request'.
            ls_fc-coltext = 'Transport Request'.
            ls_fc-no_sum = 'X'.
            ls_fc-style = CL_GUI_ALV_GRID=>MC_STYLE_HOTSPOT.
            ls_fc-outputlen = 30.
        ENDCASE.
        APPEND ls_fc TO gt_fc.
      ENDLOOP.
    ENDFORM.
    Edited by: Tobias Fickinger on Jun 10, 2009 9:59 AM
    Edited by: Tobias Fickinger on Jun 10, 2009 10:00 AM
    Edited by: Tobias Fickinger on Jun 10, 2009 10:03 AM

  • Drop Down List in ALV with Event handler

    Hi All ,
    I have created an ALV grid with a dropdown as one of the columns. This all works fine, except that I want to be able to react to a change in the value of each line's dropdown the next column values should change according to the user selection in the 1st column .
    Is this possible?
    As an example, I have a table of records with one column as a dropdown called " Replace Function Module "   and in 2nd column i have call function of that Replace Function Module , If a  change in " Replace Function Module " should change the call function of in the 2nd column .
    I am using these objects lvc_t_drop , lvc_s_drop and  the method  " set_drop_down_table ",
    Please Can any 1 tel me how to do this with any event handler ar any other way !

    Hi,
    You need to use event handler for this. Check if the below link gives some direction.
    [http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01|http://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/cda3992d-0e01-0010-90b2-c4e1f899ac01]
    I guess you should create a method inside which you call the FM using the FM name from the selected cell in ALV.
    I have not tried it out, but its worth a try.
    Hope this helps!
    Regards,
    Saumya

  • ALV GRID - EVENT HANDLING

    Hi all,
       Please let me know how to hanldle  event handling , making a cell in editable mode ,double click and hotspot creation,colorign a single cell,calling a transatcion when clicked on hotspot in a alv grid display program (not using OO   concepts).
    Looikng forward for a positive response.
    Reagrds,
    Mohinder.

    Hi,
    You can create your own custom status and asign it to your
    ALV GRID. Here is a sample code to add custom status and handling events.
    http://www.geocities.com/mpioud/Z_DEMO_ALV_REFRESH_BUTTON.html
    Reward Points if found helpfull..
    Cheers,
    Chandra Sekhar.

  • Reg ALV Hyperlink event handling in WDA

    Hi,
    I am using one ALV for Invoice in WDA. There in that ALV, column containing VBELN has been defined as Hyperlink. On clicking of VBELN, detail about that should be opened up as PDF.
    So far, this is working. But, my problem is, if once VBELN has been selected, next clicking does not pass diff VBELN.
    I need to know how can I handle  clicking on diff VBELN in my Invoice ALV?
    If there is anything like clear or refresh, that need to be invoked in Afteraction or Beforeaction or WdModifyView...?
    Or is there a syntax like
    wdContext.currentContextElement().setSpace(" ");
    for getElement( ) also...?
    Thanks.
    Kumar Saurav.
    Edited by: Kumar Saurav on Feb 5, 2010 8:55 AM

    Hi Arjun,
    I followed and implemented this line --
    In the DISPLAYPDF method, create a parameter ln_vbeln ref to vbeln.
    Now,
    Now when you call this method in the ON_CLICK event handler (use the help of code wizard to call the method),
    So, why should I call this method in ON_CLICK Event Handler?
    In ON_CLICK Method, this is my code that is being generated using Wizard --
    LO_EL_VBRKTAB_2->GET_ATTRIBUTE(
          EXPORTING
            NAME =  `VBELN`
          IMPORTING
            VALUE = LV_VBELN ).
    In addition, I am just firing the Plug to call View that has PDF Container - InteractiveForm Element.
    And, DISPLAYPDF is a Method defined in ComponentController Method Tab. There, I am employing the logic to fetch the data using Wizard from diff nodes and processing those to give the output from Smartforms as PDF.
    There, I've defined ln_vbeln, but, an error comes stating - ln_vbeln cannot be a table, a reference, a string, or contain any of these objects
    Here, my question is I've defined my steps. Let me do it in numbers--
    1) View for Input defined
    2) View to contain output ALV defined
    3) View to contain PDF defined
    4) Method ON_CLICK defined in second View
    5) Method DISPLAYPDF defined in COMPONENTCONTROLLER's Method Tab
    Now, suggest me what to do and where?
    Thanks.
    Kumar Saurav.

  • ALV Button event handling

    I have added a custom button on ALV toolbar of my web dynpro view. Now when user click that button, i want to implement the functionality...like onAction...How to do that...where do i need to write the code and how can i capture the button event...
    pls suggest

    Hi ,
    write following to create button:
    DATA: ui_btn1                     TYPE REF TO cl_salv_wd_fe_button.
      DATA: ui_sepa1                    TYPE REF TO cl_salv_wd_fe_separator.
      DATA: sepa1                       TYPE REF TO cl_salv_wd_function.
      DATA: btn1                        TYPE REF TO cl_salv_wd_function.
      data: lr_disp_button type ref to cl_salv_wd_fe_button.
      data: lv_button_text type string.
      CREATE OBJECT ui_btn1.
      CREATE OBJECT ui_sepa1.
      create object lr_disp_button.
    /to create new buttons...
      lv_button_text = 'Refresh Selection'.
      lr_disp_button->set_text( lv_button_text ).
    lr_disp_button->SET_IMAGE_SOURCE( 'ICON_DISPLAY' ).
      btn1 = l_value->if_salv_wd_function_settings~create_function( id = 'LSBUTTON' ).
      btn1->set_editor( lr_disp_button ).
    IN methods tab of view declare:
    ON_REFRESH     Event Handler     On refresh function pf ALV     ON_FUNCTION     INTERFACECONTROLLER     ALV
    in method ON_REFRESH write below code:
      DATA: temp TYPE string.
      temp = r_param->id.
      IF temp = 'LSBUTTON'.
    custom functional;ity
      endif.
    where :
    R_PARAM      Importing     1     IF_SALV_WD_TABLE_FUNCTION     
    This woudl solve ur purpose.
    Regards,
    Vishal.

  • JDEV 10.1.2 UIX Tree Event Handler

    Hi,
    I have built my tree bound to two ADF entities/views.
    It works fine in a small standalone application, but as soon as I try to integrate it with my main app it fails to call either the "null" or the "expand" event handler (null for page rendering and expand for... well expanding the node (see below))
    I've run it in debug and the event code just isn't getting fired
    There must be something in my main app that is intercepting the event handler before it gets to my uix handlers.
    New to all this so any help greatly appreciated!
    In summary, what would intercept default event handling in a uix page.
    Thanks
    Mark
    <handlers>
    <event name="expand">
    <method class="view.TreeUtils" method="doTreeEvent"/>
    </event>
    <event name="null">
    <method class="view.TreeUtils" method="doTreeEvent"/>
    </event>
    </handlers>

    Hi,
    it appears that if I change the forward to have 'redirect="true"' within the struts config file then this works fine now.
    Mark

  • ALV BADI event handler, delete icons

    The standard ALV Approve Working Times (RCATS_APPROVE_ACTIVITIES) has the BADI
    CATS_REPORTING.
    1)How could I handle the event on_user_command inside the BADI? 
    2)How could I also delete an ALV Toolbar icon inside the BADI? 
    Thank you for the help.

    Hi Kiran,
    I put the following inside the method IF_EX_CATS_REPORTING~BEFORE_DISPLAY_APPR of the BADI
    CALL METHOD IM_ALV_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = CL_GUI_ALV_GRID=>mc_evt_enter.
    CALL METHOD IM_ALV_GRID->REGISTER_EDIT_EVENT
        EXPORTING
          I_EVENT_ID = cl_gui_alv_grid=>mc_evt_modified.
    Nevertheless when I run the ALV and press any button the control of the program does not return to me inside the BADI. What else should I do.

  • Tree event handling

    Hi,
        I had a Tlayout.In that the left view is a Tree. When I clicked a particular element in the Tree on the left View I want the details of it to be displayed in the right View. What is the code for handling the click event of a tree and load a  view corresponding to the clicked element and display it in right view.
    Thanks in Advance
      Safeer.I

    Error Summary
    While processing the current request, an exception occured which could not be handled by the application or the framework.
    If the information contained on this page doesn't help you to find and correct the cause of the problem, please contact your system administrator. To facilitate analysis of the problem, keep a copy of this error page. Hint: Most browsers allow to select all content, copy it and then paste it into an empty document (e.g. email or simple text file).
    Root Cause
    The initial exception that caused the request to fail, was:
       java.lang.NullPointerException
        at hbs.saf.TreeTut1View.wdDoModifyView(TreeTut1View.java:234)
        at hbs.saf.wdp.InternalTreeTut1View.wdDoModifyView(InternalTreeTut1View.java:220)
        at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doModifyView(DelegatingView.java:78)
        at com.sap.tc.webdynpro.progmodel.view.View.modifyView(View.java:308)
        at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.doModifyView(ClientComponent.java:480)
        ... 27 more
    See full exception chain for details.
    System Environment
    Client
    Web Dynpro Client Type HTML Client
    User agent Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322)
    Version null
    DOM version null
    Client Type msie6
    Client Type Profile ie6
    ActiveX enabled
    Cookies enabled
    Frames enabled
    Java Applets enabled
    JavaScript enabled
    Tables enabled
    VB Script enabled
    Server
    Web Dynpro Runtime Vendor: SAP, build ID: 7.0007.20060331081328.0000 (release=645_VAL_REL, buildtime=2006-03-31:06:24:04[UTC], changelist=396896, host=pwdfm101), build date: Wed Mar 28 16:13:15 GMT+05:30 2007
    J2EE Engine No information available
    Java VM Java HotSpot(TM) Server VM, version:1.4.2_12-b03, vendor: Sun Microsystems Inc.
    Operating system Windows 2003, version: 5.2, architecture: x86
    Session & Other
    Session Locale en_US
    Time of Failure Tue Jul 31 11:10:50 GMT+05:30 2007 (Java Time: 1185860450203)
    Web Dynpro Code Generation Infos
    local/TreeTut1
    SapDictionaryGenerationCore 7.0009.20060802115015.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:24:21[UTC], changelist=413123, host=PWDFM101.wdf.sap.corp)
    SapDictionaryGenerationTemplates (unknown)
    SapGenerationFrameworkCore 7.0009.20060719095755.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:12:57[UTC], changelist=411255, host=PWDFM101.wdf.sap.corp)
    SapIdeWebDynproCheckLayer 7.0009.20060802115035.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:30:00[UTC], changelist=413124, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCommon 7.0009.20060210160857.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:13:46[UTC], changelist=388995, host=PWDFM101.wdf.sap.corp)
    SapMetamodelCore 7.0009.20060210160857.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:13:38[UTC], changelist=388995, host=PWDFM101.wdf.sap.corp)
    SapMetamodelDictionary 7.0009.20060719095619.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:21:59[UTC], changelist=411251, host=PWDFM101.wdf.sap.corp)
    SapMetamodelWebDynpro 7.0009.20060428190938.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:26:52[UTC], changelist=400815, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationCTemplates 7.0009.20060804145649.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:45:29[UTC], changelist=413534, host=pwdfm101)
    SapWebDynproGenerationCore 7.0009.20060802115035.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:30:11[UTC], changelist=413124, host=PWDFM101.wdf.sap.corp)
    SapWebDynproGenerationTemplates 7.0009.20060804145649.0000 (release=645_VAL_REL, buildtime=2006-08-26:14:45:29[UTC], changelist=413534, host=pwdfm101)
    sap.com/tcwddispwda
    No information available null
    sap.com/tcwdcorecomp
    No information available null
    Detailed Error Information
    Detailed Exception Chain
    java.lang.NullPointerException
         at hbs.saf.TreeTut1View.wdDoModifyView(TreeTut1View.java:234)
         at hbs.saf.wdp.InternalTreeTut1View.wdDoModifyView(InternalTreeTut1View.java:220)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doModifyView(DelegatingView.java:78)
         at com.sap.tc.webdynpro.progmodel.view.View.modifyView(View.java:308)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.doModifyView(ClientComponent.java:480)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doModifyView(WindowPhaseModel.java:551)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:148)
         at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:330)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:297)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:706)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:660)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:228)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:152)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:56)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:40)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:390)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:264)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:347)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:325)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:887)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:241)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:92)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:148)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(Native Method)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:100)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:170)

  • Alv tree editable fields?

    Hi gusrus does any one knows if there is a way to set an entire
    column editable or maybe only a cell in an alvtree
    thanks

    ok first you have to register the alv tree event handler for double click, once you have done this you need to use the method
    g_alv_tree->get_selected_item, once you have got  the selected node by using the g_alv_tree->get_selected_item , you have to use the method g_alv_tree->get_outtab_line, then use the function 'POPUP_GET_VALUES', and finaly use the method  g_alv_tree->change_item where you can insert the obtained values from   'POPUP_GET_VALUES'.
    thanks i hope you can solve your problem, let me know if you want to receive my source code because i think is complex explaning by here.
    regards

  • How to handle check box events in alv tree.

    hi,
    i am working in CL_GUI_COLUMN_TREE class.Also using Check box. Now i want to handle events for check box . I am new to ABAP Objects.
    Pls expaline in detail or send code
    thanks in advance,
    senthil kumar.r

    Hello Senthil
    Have a look at the sample report
    SAPCOLUMN_TREE_CONTROL_DEMO
    . The crucial points are:
    <b>(1) Register the required events at the control</b>
    * define the events which will be passed to the backend
      " checkbox change
      event-eventid = CL_GUI_COLUMN_TREE=>EVENTID_checkbox_change.
      event-appl_event = 'X'.
      append event to events.
      CALL METHOD G_TREE->SET_REGISTERED_EVENTS
        EXPORTING
          EVENTS = EVENTS
        EXCEPTIONS
          CNTL_ERROR                = 1
          CNTL_SYSTEM_ERROR         = 2
          ILLEGAL_EVENT_COMBINATION = 3.
      IF SY-SUBRC <> 0.
        MESSAGE A000.
      ENDIF.
    <b>(2) Set the event handler</b>
    assign event handlers in the application class to each desired event
      SET HANDLER G_APPLICATION->HANDLE_CHECKBOX_CHANGE FOR g_tree.
    <b>(3) Define and implement event handler method</b>
      METHOD  HANDLE_CHECKBOX_CHANGE.
        " this method handles the checkbox_change event of the tree
        " control instance
        " show the key of the node and the name of the item
        " of the clicked checkbox in a dynpro field
        G_EVENT = 'CHECKBOX_CHANGE'.
        G_NODE_KEY = NODE_KEY.
        G_ITEM_NAME = ITEM_NAME.
        CLEAR  G_HEADER_NAME.
      ENDMETHOD.
    Regards
      Uwe

  • Event Handling in Tree structure

    Hi all,
      I have created an alv tree structure using the FM's 'RS_TREE_CONSTRUCT' and  'RS_TREE_LIST_DISPLAY'. Can anyone tell me how to handle double-click event with these FM's. My requirement is that i should display the tree structure of the Materials from Raw material till Finished materials and i have done that. After that, when i select one of these materials (Either double-click or provide some icon for each item and select that icon), i should be able to call an existing report with the data of the line selected.
    Any help will be greatly appreciable.
    thanks and regards,
    Raja Sekhar.

    Hi Raja..
    This post was from long back..
    And today i have same requirement.. So could you tell me that what you have done for this...
      Thanks in Advace

  • Event Handling for tree structure using "CL_GUI_ALV_TREE_SIMPLE"

    Hi,
    I have created a tree structure using class CL_GUI_ALV_TREE_SIMPLE.
    Now I wanted to insert a check and give message when the user opens the last node in my structure.
    I checked the events available in the class , but there in none which gets trigered when we try to open a node.
    Please guide me with this scenario.
    Thanks & Regards,
    Omkar M.

    Hello Omkar
    The solution is somewhat odd but apparently works. As sample report please check BCALV_TREE_SIMPLE_DEMO.
    Copy this report and make the following changes:
    class lcl_tree_event_receiver definition.
      public section.
        methods:
        on_expand_no_children " new event handler method
          for event expand_no_children of cl_gui_column_tree
            importing NODE_KEY,  " class = CL_GUI_COLUMN_TREE !!!
        on_add_hierarchy_node
                  for event on_add_hierarchy_node of cl_gui_alv_tree_simple
                        importing grouplevel
                                  index_outtab.
    endclass.
    CLASS lcl_tree_event_receiver IMPLEMENTATION.
      METHOD on_expand_no_children.
        BREAK-POINT.
      ENDMETHOD.                    "on_expand_no_children
    FORM 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_node_context_menu_req.
      APPEND l_event TO lt_events.
      l_event-eventid = cl_gui_column_tree=>eventid_expand_no_children.
      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.
    * set Handler
      DATA: l_event_receiver TYPE REF TO lcl_tree_event_receiver.
      CREATE OBJECT l_event_receiver.
      SET HANDLER l_event_receiver->on_add_hierarchy_node
                                                            FOR tree1.  " CL_GUI_ALV_TREE_SIMPLE
      SET HANDLER l_event_receiver->on_expand_no_children
                                              FOR ALL INSTANCES. " CL_GUI_COLUMN_TREE !!!
    ENDFORM.                               " register_events
    As soon as you open a node in the ALV tree the report will stop at the break-point.
    Now you need to check if there are still children nodes to be displayed.
    If not then trigger your special coding.
    Regards
      Uwe

  • Hot spot event on alv tree

    hi.....
    whats the event for hotspot or single click on node event
    thanks.

    Hi,
    If you want to get it through grid you can go through the sample code...
    The sample program explains on how to achieve hotspot apply the same for alv tree...
    REPORT  Z_ALV_HOTSPOT.
    TABLES:EKKO.
    SELECT-OPTIONS:S_EBELN FOR EKKO-EBELN.
        INTERNAL TABLE FOR EKKO
    DATA: TB_EKKO TYPE STANDARD TABLE OF EKKO,
        INTERNAL TABLE FOR EKPO
          TB_EKPO TYPE STANDARD TABLE OF EKPO,
          DA_TOP  TYPE REF TO CL_DD_DOCUMENT,
          DW_TOP  TYPE REF TO CL_DD_DOCUMENT.
    DATA:
        GRIDS
          EKKO_GRID TYPE REF TO CL_GUI_ALV_GRID,
          EKPO_GRID TYPE REF TO CL_GUI_ALV_GRID,
        CONTAINERS
          EKKO_CONTAINER        TYPE REF TO CL_GUI_CONTAINER,
          EKPO_CONTAINER        TYPE REF TO CL_GUI_CONTAINER,
          TOP_OF_PAGE_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
          DTOP_OF_PAGE_CONTAINER TYPE REF TO CL_GUI_CONTAINER,
          DMAIN_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          MAIN_CONTAINER TYPE REF TO CL_GUI_CUSTOM_CONTAINER,
          SPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
          DSPLITTER TYPE REF TO CL_GUI_SPLITTER_CONTAINER,
        LAYOUT
          X_LAYOUT TYPE LVC_S_LAYO,
        WORK AREA
          X_EKKO LIKE EKKO.
      DATA: FLAG TYPE C,
            flag_top type c.
          CLASS LCL_HANDLER DEFINITION
    CLASS LCL_HANDLER DEFINITION.
      PUBLIC SECTION.
        CLASS-METHODS:HANDLER_HOTSPOT_CLICK FOR EVENT HOTSPOT_CLICK OF
         CL_GUI_ALV_GRID IMPORTING E_ROW_ID.
        CLASS-METHODS:HANDLER_TOP_OF_PAGE FOR EVENT TOP_OF_PAGE OF
         CL_GUI_ALV_GRID .
    ENDCLASS.                    "LCL_HANDLER DEFINITION
          CLASS LCL_HANDLER IMPLEMENTATION
    CLASS LCL_HANDLER IMPLEMENTATION.
      METHOD HANDLER_HOTSPOT_CLICK.
    CLEAR X_EKKO.
    CLEAR TB_EKKO.
        READ TABLE TB_EKKO INDEX E_ROW_ID-INDEX INTO X_EKKO.
        IF SY-SUBRC = 0.
          PERFORM GET_ITEM_DETAILS USING X_EKKO-EBELN.
        ENDIF.
      ENDMETHOD.                    "HANDLER_HOTSPOT_CLICK
      METHOD HANDLER_TOP_OF_PAGE.
        CALL METHOD DA_TOP->ADD_TEXT
          EXPORTING
            TEXT = 'Top Of Page'.
        CALL METHOD DA_TOP->DISPLAY_DOCUMENT
          EXPORTING
            PARENT = TOP_OF_PAGE_CONTAINER.
    if flag_top = 'X'.
    CALL METHOD DW_TOP->ADD_TEXT
          EXPORTING
            TEXT = 'ITEM Top Of Page '.
        CALL METHOD DW_TOP->DISPLAY_DOCUMENT
          EXPORTING
            PARENT = DTOP_OF_PAGE_CONTAINER.
      flag_top = ' '.
    endif.
      ENDMETHOD.                    "HANDLER_TOP_OF_PAGE
    ENDCLASS.                    "LCL_HANDLER IMPLEMENTATION
    *&      Module  STATUS_0100  OUTPUT
    MODULE STATUS_0100 OUTPUT.
      SET PF-STATUS 'ABC'.
    ENDMODULE.                 " STATUS_0100  OUTPUT
    *&      Form  GET_DATA
    MODULE GET_DATA OUTPUT.
      SELECT * UP TO 5 ROWS INTO TABLE TB_EKKO FROM EKKO WHERE EBELN IN
      S_EBELN.
    ENDMODULE.                    " GET_DATA
                             START OF SELECTION.
    START-OF-SELECTION.
      CALL SCREEN 100.
    *&      Module  DISPLAY_DATA  OUTPUT
          text
    MODULE DISPLAY_DATA OUTPUT.
    CREATING CONTAINER OBJ*******
      CREATE OBJECT MAIN_CONTAINER
        EXPORTING
          CONTAINER_NAME               = 'CONT1'
        EXCEPTIONS
          CNTL_ERROR                  = 1
          CNTL_SYSTEM_ERROR           = 2
          CREATE_ERROR                = 3
          LIFETIME_ERROR              = 4
          LIFETIME_DYNPRO_DYNPRO_LINK = 5
          OTHERS                      = 6
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CREATE OBJECT SPLITTER
                        EXPORTING TOP     = 5
                                  PARENT  = MAIN_CONTAINER
                                  ROWS    = 2
                                  COLUMNS = 1.
      CALL METHOD SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 1
          COLUMN    = 1
        RECEIVING
          CONTAINER = TOP_OF_PAGE_CONTAINER.
      CALL METHOD SPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 2
          COLUMN    = 1
        RECEIVING
          CONTAINER = EKKO_CONTAINER.
    CREATING GRID OBJ AND ASSAIGNING TO CONTAINER ****
      CREATE OBJECT EKKO_GRID
        EXPORTING
          I_PARENT          =  EKKO_CONTAINER
        EXCEPTIONS
          ERROR_CNTL_CREATE = 1
          ERROR_CNTL_INIT   = 2
          ERROR_CNTL_LINK   = 3
          ERROR_DP_CREATE   = 4
          OTHERS            = 5
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    LAYOUT SETTINGS ***
      X_LAYOUT-ZEBRA  = 'X'.
      X_LAYOUT-KEYHOT = 'X'.
    TO DISPLAY TB_EKKO CONTENTS  ********
      CALL METHOD EKKO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'EKKO'
          IS_LAYOUT                     = X_LAYOUT
        CHANGING
          IT_OUTTAB                     = TB_EKKO
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    ***REGESTRING HANDLER FOR HOT SPOT CLICK EVENT
      SET HANDLER LCL_HANDLER=>HANDLER_HOTSPOT_CLICK FOR EKKO_GRID.
      SET HANDLER LCL_HANDLER=>HANDLER_TOP_OF_PAGE FOR EKKO_GRID.
    For Top Of Page
      CREATE OBJECT DA_TOP
        EXPORTING STYLE = 'ALV_GRID'.
      CALL METHOD DA_TOP->INITIALIZE_DOCUMENT.
      CALL METHOD EKKO_GRID->LIST_PROCESSING_EVENTS
        EXPORTING
          I_EVENT_NAME = 'TOP_OF_PAGE'
          I_DYNDOC_ID  = DA_TOP.
    ENDMODULE.                 " DISPLAY_DATA  OUTPUT
    *&      Module  USER_COMMAND_0100  INPUT
    MODULE USER_COMMAND_0100 INPUT.
      CASE SY-UCOMM.
        WHEN 'EXIT'.
          LEAVE TO SCREEN 0.
        WHEN 'CANCEL'.
          LEAVE TO SCREEN 0.
        WHEN 'BACK'.
          LEAVE TO SCREEN 0.
        WHEN 'OTHERS'.
          LEAVE TO SCREEN 0.
      ENDCASE.
    ENDMODULE.                 " USER_COMMAND_0100  INPUT
    *&      Form  GET_ITEM_DETAILS
    FORM GET_ITEM_DETAILS  USING  P_EKKO_EBELN TYPE EKKO-EBELN.
      CLEAR TB_EKPO[].
      SELECT * UP TO 5 ROWS INTO TABLE TB_EKPO FROM EKPO WHERE EBELN =
      P_EKKO_EBELN.
      IF FLAG IS INITIAL.
        FLAG = 'X'.
    CREATING CONTAINER OBJ*******
        CREATE OBJECT DMAIN_CONTAINER
          EXPORTING
            CONTAINER_NAME               = 'CONT2'
          EXCEPTIONS
            CNTL_ERROR                  = 1
            CNTL_SYSTEM_ERROR           = 2
            CREATE_ERROR                = 3
            LIFETIME_ERROR              = 4
            LIFETIME_DYNPRO_DYNPRO_LINK = 5
            OTHERS                      = 6
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    CREATE OBJECT DSPLITTER
                        EXPORTING TOP     = 5
                                  PARENT  = DMAIN_CONTAINER
                                  ROWS    = 2
                                  COLUMNS = 1.
      CALL METHOD DSPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 1
          COLUMN    = 1
        RECEIVING
          CONTAINER = DTOP_OF_PAGE_CONTAINER.
      CALL METHOD DSPLITTER->GET_CONTAINER
        EXPORTING
          ROW       = 2
          COLUMN    = 1
        RECEIVING
          CONTAINER = EKPO_CONTAINER.
    CREATING GRID OBJ AND ASSAIGNING TO CONTAINER ****
        CREATE OBJECT EKPO_GRID
          EXPORTING
            I_PARENT          =  EKPO_CONTAINER
          EXCEPTIONS
            ERROR_CNTL_CREATE = 1
            ERROR_CNTL_INIT   = 2
            ERROR_CNTL_LINK   = 3
            ERROR_DP_CREATE   = 4
            OTHERS            = 5
        IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
      ENDIF.
    LAYOUT SETTINGS ***
      X_LAYOUT-ZEBRA  = 'X'.
    TO DISPLAY TB_EKPO CONTENTS  ********
      CALL METHOD EKPO_GRID->SET_TABLE_FOR_FIRST_DISPLAY
        EXPORTING
          I_STRUCTURE_NAME              = 'EKPO'
          IS_LAYOUT                     = X_LAYOUT
        CHANGING
          IT_OUTTAB                     = TB_EKPO
        EXCEPTIONS
          INVALID_PARAMETER_COMBINATION = 1
          PROGRAM_ERROR                 = 2
          TOO_MANY_LINES                = 3
          OTHERS                        = 4.
      IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
               WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
    SET HANDLER LCL_HANDLER=>HANDLER_TOP_OF_PAGE FOR EKPO_GRID.
    For Top Of Page
      CREATE OBJECT DW_TOP
        EXPORTING STYLE = 'ALV_GRID'.
      CALL METHOD DW_TOP->INITIALIZE_DOCUMENT.
    flag_top = 'X'.
      CALL METHOD EKPO_GRID->LIST_PROCESSING_EVENTS
        EXPORTING
          I_EVENT_NAME = 'TOP_OF_PAGE'
          I_DYNDOC_ID  = DW_TOP.
    ENDFORM.                    " GET_ITEM_DETAILS
    <b>Reward points for all helpful answers.</b>
    Regards,
    Azaz Ali.

  • Handling  single click in alv tree

    Hello Friends,
    Is there an event triggered,for single click on an alv tree.
    regards
    kaushik

    hi ,
    it_fieldcat-hotspot = 'X'.
    regards,
    venkat.
    Edited by: venkat  appikonda on Mar 13, 2008 8:11 PM
    Edited by: venkat  appikonda on Mar 13, 2008 8:12 PM

Maybe you are looking for

  • Early 2010 Macbook Unibody; connecting to TV

    I bought my white unibody 2.26 GHZ Intel Core 2 Duo Macbook earlier this year. I saw that the Mini DVI to Video will not work for the newer one which is what I used to use with my first generation Macbook. What is the simplest way to connect the newe

  • Macbook (2.1Ghz white 2008 model) display won't turn on during start-up

           hi all, my problem is pretty simple. Sometimes, after having used an external display with my Macbook (using the Apple Mini DVI > DVI adaptor: http://store.apple.com/au/product/M9321G/B?mco=MTY3ODQ5OTY ) the Macbook's own display won't power o

  • ISight not recording sound in

    So, Ive been playing around with Photobooth, and recently, I've lost the ability to record the sound of the videos I make through it. I've checked the sys pref and test the audio input mic and the bars move just fine. I can even record sound from the

  • Error in settlement of IO to AUC through T-code KO88

    Hi All, I created 3 Internel order for 3 wings(Building floor).While i am doing settlement by T-Code KO88 from INTERNAL ORDER to AUC the following error is acquring " EITHER THE SENDER IS ALREADY SETTLED, OR THERE IS NOTHING TO SETTLE". But i checked

  • Garbled Text with Tiger Install

    need some help with a G4 Dual 1 ghz M8493 Quicksilver that I bought that has some issues with the operating system. I erased the 80G drive and free space and Installed Tiger by starting up on the install disk all the text was jumbled up and missing.