<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Classes and Methods - handle_double_click in Application Development and Automation Discussions</title>
    <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes-and-methods-handle-double-click/m-p/4026302#M962230</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;   I am working on classes and methods now. I have a doubt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have declared as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_event_receiver DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;     handle_double_click&lt;/P&gt;&lt;P&gt;        FOR EVENT double_click OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;        IMPORTING e_row e_column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_event_receiver IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Method to handle the double click.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  METHOD handle_double_click.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF e_row-rowtype IS INITIAL.&lt;/P&gt;&lt;P&gt;      READ TABLE tb_output INDEX e_row-index INTO wa_out.&lt;/P&gt;&lt;P&gt;      PERFORM get_secondary_list.&lt;/P&gt;&lt;P&gt;      PERFORM display_secondary_list.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "handle_double_click&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, can't i define the same method 'handle_double_click' with some other functionality in IMPLEMETATION?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the first screen when it is double clicked it should take me to screen 200. Inside 200, if i double click on somthing..it should take me to screen 3. But it is taking me to screen 200 again. Please help me put. It's urgent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks  a lot.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Seenu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 19 Jun 2008 06:59:05 GMT</pubDate>
    <dc:creator>Former Member</dc:creator>
    <dc:date>2008-06-19T06:59:05Z</dc:date>
    <item>
      <title>Classes and Methods - handle_double_click</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes-and-methods-handle-double-click/m-p/4026302#M962230</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All,&lt;/P&gt;&lt;P&gt;   I am working on classes and methods now. I have a doubt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have declared as:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_event_receiver DEFINITION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  PUBLIC SECTION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    METHODS:&lt;/P&gt;&lt;P&gt;     handle_double_click&lt;/P&gt;&lt;P&gt;        FOR EVENT double_click OF cl_gui_alv_grid&lt;/P&gt;&lt;P&gt;        IMPORTING e_row e_column.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;CLASS lcl_event_receiver IMPLEMENTATION.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;UL&gt;&lt;LI level="1" type="ul"&gt;&lt;P&gt;Method to handle the double click.&lt;/P&gt;&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;  METHOD handle_double_click.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;    IF e_row-rowtype IS INITIAL.&lt;/P&gt;&lt;P&gt;      READ TABLE tb_output INDEX e_row-index INTO wa_out.&lt;/P&gt;&lt;P&gt;      PERFORM get_secondary_list.&lt;/P&gt;&lt;P&gt;      PERFORM display_secondary_list.&lt;/P&gt;&lt;P&gt;    ENDIF.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;  ENDMETHOD.                    "handle_double_click&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;ENDCLASS.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now, can't i define the same method 'handle_double_click' with some other functionality in IMPLEMETATION?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;From the first screen when it is double clicked it should take me to screen 200. Inside 200, if i double click on somthing..it should take me to screen 3. But it is taking me to screen 200 again. Please help me put. It's urgent.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks  a lot.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Seenu&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 06:59:05 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/classes-and-methods-handle-double-click/m-p/4026302#M962230</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-19T06:59:05Z</dc:date>
    </item>
    <item>
      <title>Re: Classes and Methods - handle_double_click</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes-and-methods-handle-double-click/m-p/4026303#M962231</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz look into below code it will help you.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE&gt;&lt;CODE&gt;
class lcl_event_receiver definition deferred.
*
*********


data: ok_code like sy-ucomm,
      save_ok like sy-ucomm,
      g_max type i value 100,
      gt_sflight type table of sflight,
      gt_sbook type table of sbook,
      g_repid like sy-repid,
      gs_layout   type lvc_s_layo,
      cont_for_flights   type scrfname value 'BCALV_GRID_02_100',
      grid1  type ref to cl_gui_alv_grid,
      custom_container type ref to cl_gui_custom_container,
      grid2  type ref to cl_gui_alv_grid,
* reference to dialogbox container.
      dialogbox_container type ref to cl_gui_dialogbox_container,
* reference to local class that handles events of GRID1 and
* DIALOGBOX_CONTAINER
      event_receiver type ref to lcl_event_receiver.

* Set initial dynpro
set screen 100.

****************************************************************
* LOCAL CLASSES: Definition
****************************************************************
*===============================================================
* class lcl_event_receiver: local class to handle event DOUBLE_CLICK
*                           and CLOSE.
*
* Definition:
* ~~~~~~~~~~~
class lcl_event_receiver definition.

  public section.
    methods:

    handle_double_click
        for event double_click of cl_gui_alv_grid
            importing e_row e_column,
    handle_close
        for event close of cl_gui_dialogbox_container
            importing sender.

  private section.
   data: dialogbox_status type c.  "'X': does exist, SPACE: does not ex.

endclass.
*
* lcl_event_receiver (Definition)
*===============================================================

****************************************************************
* LOCAL CLASSES: Implementation
****************************************************************
*===============================================================
* class c_event_receiver (Implementation)
*
* In this example, only event DOUBLE_CLICK is caught
*
class lcl_event_receiver implementation.

* §3.At doubleclick(1): The event DOUBLE_CLICK provides
*    parameters of the clicked row and column.
*    Use row parameter to select a line of the
*    corresponding internal table.
  method handle_double_click.
    data: ls_sflight like line of gt_sflight.

* read selected row from internal table gt_sflight
    read table gt_sflight index e_row-index into ls_sflight.

* §4.At Doubleclick(2): Select booking data
    perform select_table_sbook using ls_sflight
                               changing gt_sbook.

* §5.At doubleclick(3): Create dialogbox to show detail list
*   (if not already existent)
    if dialogbox_status is initial.
      dialogbox_status = 'X'.
      perform create_detail_list.
    else.
      call method dialogbox_container-&amp;gt;set_visible
                       exporting visible = 'X'.
      call method grid2-&amp;gt;refresh_table_display.
    endif.
  endmethod.
*--------------------------------------------------------*
  method handle_close.
* §6.Handle the CLOSE-button of the dialogbox

* set dialogbox invisible
* (the dialogbox is destroyed outomatically when the user
* switches to another dynpro).
    call method sender-&amp;gt;set_visible
          exporting visible = space.
* In this example closing the dialogbox leads
* to make it invisible. It is also conceivable to destroy it
* and recreate it if the user doubleclicks a line again.
* Displaying a great amount of data has a greater impact on performance.
  endmethod.

endclass.
*
* lcl_event_receiver (Implementation)
*===================================================================

*---------------------------------------------------------------------*
*       FORM EXIT_PROGRAM                                             *
*---------------------------------------------------------------------*
form exit_program.
  call method custom_container-&amp;gt;free.
  call method cl_gui_cfw=&amp;gt;flush.
  if sy-subrc ne 0.
* add your handling, for example
    call function 'POPUP_TO_INFORM'
         exporting
              titel = g_repid
              txt2  = sy-subrc
              txt1  = 'Error in FLush'(500).
  endif.
  leave program.
endform.
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  PBO_100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module pbo_100 output.

  set pf-status 'MAIN100'.
  set titlebar 'MAIN100'.
  g_repid = sy-repid.
* §1.Create one ALV Control that shows the first table.
  if custom_container is initial.
* select data from table SFLIGHT
    perform select_table_sflight changing gt_sflight.

* create a custom container control for our ALV Control
    create object custom_container
        exporting
            container_name = cont_for_flights
        exceptions
            cntl_error = 1
            cntl_system_error = 2
            create_error = 3
            lifetime_error = 4
            lifetime_dynpro_dynpro_link = 5.
    if sy-subrc ne 0.
* add your handling, for example
      call function 'POPUP_TO_INFORM'
           exporting
                titel = g_repid
                txt2  = sy-subrc
                txt1  = 'The control could not be created'(510).
    endif.
* create an instance of alv control
    create object grid1
         exporting i_parent = custom_container.
*
* Set a titlebar for the grid control
*
    gs_layout-grid_title = 'Flights'(100).

    call method grid1-&amp;gt;set_table_for_first_display
         exporting i_structure_name = 'SFLIGHT'
                   is_layout        = gs_layout
         changing  it_outtab        = gt_sflight.

********
* -&amp;gt;Create Object to receive events and link them to handler methods.
* When the ALV Control raises the event for the specified instance
* the corresponding method is automatically called.
*
    create object event_receiver.
    set handler event_receiver-&amp;gt;handle_double_click for grid1.
*
********

  endif.                               "IF custom_container IS INITIAL
  call method cl_gui_control=&amp;gt;set_focus exporting control = grid1.

* Control Framework flushes at the end of PBO automatically!

endmodule.                             " PBO_100  OUTPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Module  PAI_100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
module pai_100 input.
  save_ok = ok_code.
  case save_ok.
    when 'BACK'.
      perform exit_program.
    when 'EXIT'.
      perform exit_program.
  endcase.
  clear save_ok.
endmodule.                             " PAI_100  INPUT
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  SELECT_TABLE_SFLIGHT
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      &amp;lt;--P_GT_SFLIGHT  text
*----------------------------------------------------------------------*
form select_table_sflight changing p_gt_sflight like gt_sflight[].
  select * from sflight into table p_gt_sflight up to g_max rows.
endform.                               " SELECT_TABLE_SFLIGHT

*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  SELECT_TABLE_SBOOK
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*      --&amp;gt;P_LS_SFLIGHT  text
*      &amp;lt;--P_GT_SBOOK  text
*----------------------------------------------------------------------*
form select_table_sbook using    p_ls_sflight like line of gt_sflight
                        changing p_gt_sbook like gt_sbook[].

  select * from  sbook into table p_gt_sbook
         where  carrid  = p_ls_sflight-carrid
         and    connid  = p_ls_sflight-connid
         and    fldate  = p_ls_sflight-fldate.

endform.                               " SELECT_TABLE_SBOOK
*&amp;amp;---------------------------------------------------------------------*
*&amp;amp;      Form  create_detail_list
*&amp;amp;---------------------------------------------------------------------*
*       text
*----------------------------------------------------------------------*
*  --&amp;gt;  p1        text
*  &amp;lt;--  p2        text
*----------------------------------------------------------------------*
form create_detail_list.
* create dialogbox container as dynpro-instance
* When the user switches to another screen, it is
* destroyed by lifetime mangagement of CFW
      create object dialogbox_container
          exporting
            top = 150
            left = 150
            lifetime = cntl_lifetime_dynpro
            caption = 'Bookings'(200)
            width = 800
            height = 200.
      create object grid2
          exporting i_parent = dialogbox_container.
* Register ABAP OO event 'CLOSE'. It is not necessary to register this
* event at the frontend (this is done during creation).
      set handler event_receiver-&amp;gt;handle_close for dialogbox_container.

* display data
      gs_layout-grid_title = space.
      call method grid2-&amp;gt;set_table_for_first_display
           exporting i_structure_name = 'SBOOK'
                     is_layout        = gs_layout
           changing  it_outtab        = gt_sbook.

      call method cl_gui_control=&amp;gt;set_focus exporting control = grid2.

endform.                    " create_detail_list&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This will surely work.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Plz reward if useful.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Dhanashri.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jun 2008 07:38:44 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/classes-and-methods-handle-double-click/m-p/4026303#M962231</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2008-06-19T07:38:44Z</dc:date>
    </item>
    <item>
      <title>Re: Classes and Methods - handle_double_click</title>
      <link>https://community.sap.com/t5/application-development-and-automation-discussions/classes-and-methods-handle-double-click/m-p/4026304#M962232</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Closed&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 16 Dec 2010 05:25:14 GMT</pubDate>
      <guid>https://community.sap.com/t5/application-development-and-automation-discussions/classes-and-methods-handle-double-click/m-p/4026304#M962232</guid>
      <dc:creator>Former Member</dc:creator>
      <dc:date>2010-12-16T05:25:14Z</dc:date>
    </item>
  </channel>
</rss>

