Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Double Click event in module pool

Former Member
0 Likes
1,528

Hi,

I have created alv list using contanier, which displays sales order no & its details.

so after clicking on order no. its calls VA02 transaction.

How to get this?

Thanks in advance

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,066

hi,

Hope it helps.....

w_alv_event_rec    TYPE REF TO lcl_eventhandler,

class lcl_eventhandler definition.
PUBLIC SECTION.
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
        IMPORTING
          e_row
          e_column
          es_row_no.

endclass.

CLASS lcl_eventhandler IMPLEMENTATION.

  METHOD handle_double_click.

    CALL TRANSACTION VA02.

  ENDMETHOD.                    "handle_double_click

ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION


CREATE OBJECT w_alv_event_rec.

  SET HANDLER w_alv_event_rec->handle_double_click FOR w_grid_find. ---->THIS IS THE INSTANCE OF THE CLASS CL_GUI_ALV_GRID.

This part of the code should be written before you display the values on the grid.

CREATE OBJECT w_alv_event_rec.

SET HANDLER w_alv_event_rec->handle_double_click FOR w_grid_find. -


>THIS IS THE INSTANCE OF THE CLASS CL_GUI_ALV_GRID.

Thanks,

Ibrahim

Hi,

I have created alv list using contanier, which displays sales order no & its details.

so after clicking on order no. its calls VA02 transaction.

How to get this?

Thanks in advance

4 REPLIES 4
Read only

Former Member
0 Likes
1,067

hi,

Hope it helps.....

w_alv_event_rec    TYPE REF TO lcl_eventhandler,

class lcl_eventhandler definition.
PUBLIC SECTION.
handle_double_click FOR EVENT double_click OF cl_gui_alv_grid
        IMPORTING
          e_row
          e_column
          es_row_no.

endclass.

CLASS lcl_eventhandler IMPLEMENTATION.

  METHOD handle_double_click.

    CALL TRANSACTION VA02.

  ENDMETHOD.                    "handle_double_click

ENDCLASS.                    "lcl_eventhandler IMPLEMENTATION


CREATE OBJECT w_alv_event_rec.

  SET HANDLER w_alv_event_rec->handle_double_click FOR w_grid_find. ---->THIS IS THE INSTANCE OF THE CLASS CL_GUI_ALV_GRID.

This part of the code should be written before you display the values on the grid.

CREATE OBJECT w_alv_event_rec.

SET HANDLER w_alv_event_rec->handle_double_click FOR w_grid_find. -


>THIS IS THE INSTANCE OF THE CLASS CL_GUI_ALV_GRID.

Thanks,

Ibrahim

Read only

Former Member
0 Likes
1,066

Hi,

Add the below snippet in your program

"Declare a callback subroutine variable 
DATA: : wa_callback_subroutine TYPE slis_formname,

"intialise the subroutine variable to the routine name handling the user command double click
wa_callback_subroutine = 'USER_COMMAND'.

"simpy Add sunbroutine varibale declared above in the ALV display routine in callback_user_command import parameter
i_callback_user_command           = wa_callback_subroutine

"Define the user_command subroutine as below

FORM user_command  USING okcode    LIKE sy-ucomm
                       lselfield TYPE slis_selfield.
  CASE okcode.
    WHEN '&IC1'. " SAP standard code for double-clicking
      CASE lselfield-sel_tab_field."check if double click is only on
        WHEN '<internaltablename-fieldname>'."aufnr not on any other field
          SET PARAMETER ID 'ANR' FIELD lselfield-value.
          CALL TRANSACTION '<tcode>' AND SKIP FIRST SCREEN.
      ENDCASE.
  ENDCASE.

"OR add the code as required by you but sy-ucomm is &IC1 a

ENDFORM.                    "user_command

hope this will solve your problem.

Pooja

Read only

Former Member
0 Likes
1,066

CASE sy-ucomm.

*when user clicks a order num

WHEN '&IC1'.

READ TABLE itab INDEX slis_selfield-tabindex INTO wa_itab.

IF sy-subrc = 0.

CALL TRANSACTION wa_itab-tcode.

ENDIF.

Read only

Former Member
0 Likes
1,066

METHOD handle_double_click.

CALL METHOD gcl_alv_grid->get_current_cell

IMPORTING

e_row = lv_row

e_value = lv_value

es_col_id = ls_col_info.

If the user double clicked on the order number, lv_value will have the order number. If not, then lv_row should correspond to the row of data in the it_outtab used to display the ALV grid using call method gcl_alv_grid->set_table_for_first_display

read table it_outtab index lv_row.

Then set your parameter ID's with order # and Call Transaction.