Application Development 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: 

Double click event in ALV

Former Member
0 Kudos

Hello everybody,

I have an ALV report that uses the function module REUSE_ALV_GRID_DISPAY

to display the screen. I was wondering if there is a way to implementthe

double click event when using this FM. What I want the user to be abl to

do is to double click on a line in the ALV and have another ALV grid

display with a more detailed list. I know that the double click eventcan

be implemented using the object oriented approach using a container bu I

would like to avoid redoing the report to use the object oriented apprach.

Any help would be greatly appreciated.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Yes there is a way.

You have to call your function like this:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

...

I_CALLBACK_PROGRAM = z_variant-report

(or your program name, not sy-repid because this will

change during the use of ALV Grid)

I_CALLBACK_USER_COMMAND = 'USER_COMMAND2'

(or some other name)

...

then you define your form:

form user_command2 using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

case r_ucomm.

when '&IC1'. (doubleclick)

if rs_selfield-tabindex > 0 and

rs_selfield-sumindex le 0.

read table itab into wa index

rs_selfield-tabindex.

perform second_grid.

endif.

endcase.

then your form for the second grid:

form second_grid.

(here you can make your selections for the second grid

based on the row you selected into workarea wa from the

first grid, and then call REUSE_ALV_GRID_DISPLAY again,

with another field catalog, internal table etc...)

endform.

good luck,

Vasavi

3 REPLIES 3

Former Member
0 Kudos

you can code for it at user command, right ?

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

I_CALLBACK_PROGRAM = G_REPID

I_CALLBACK_USER_COMMAND = 'ZCALLBACK_USER_COMMAND'

........

now write a form for 'ZCALLBACK_USER_COMMAND'

FORM ZCALLBACK_USER_COMMAND USING UCOMM LIKE SY-UCOMM

RS_SELFIELD TYPE SLIS_SELFIELD.

(assuming t_output is your internal table with data.

case sy-ucomm.

when '&IC1'.

IF RS_SELFIELD-TABNAME EQ 'T_OUTPUT'.

READ TABLE T_OUTPUT INDEX RS_SELFIELD-TABINDEX.

Edited by: Sujamol Augustine on Apr 14, 2008 8:06 PM

Former Member
0 Kudos

Yes there is a way.

You have to call your function like this:

CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'

EXPORTING

...

I_CALLBACK_PROGRAM = z_variant-report

(or your program name, not sy-repid because this will

change during the use of ALV Grid)

I_CALLBACK_USER_COMMAND = 'USER_COMMAND2'

(or some other name)

...

then you define your form:

form user_command2 using r_ucomm like sy-ucomm

rs_selfield type slis_selfield.

case r_ucomm.

when '&IC1'. (doubleclick)

if rs_selfield-tabindex > 0 and

rs_selfield-sumindex le 0.

read table itab into wa index

rs_selfield-tabindex.

perform second_grid.

endif.

endcase.

then your form for the second grid:

form second_grid.

(here you can make your selections for the second grid

based on the row you selected into workarea wa from the

first grid, and then call REUSE_ALV_GRID_DISPLAY again,

with another field catalog, internal table etc...)

endform.

good luck,

Vasavi

venkat_o
Active Contributor
0 Kudos

Hi Ashish, Here is the procedure to handle Interactive ALV. 1. declare events table like this.

data :
      i_events  type slis_t_event,
      w_events  like line of i_events.
2. Build events table .
w_events-name = 'USER_COMMAND' .
w_events-form = 'USER_COMMAND' .
append w_events to i_events.
clear w_events.
3. pass this events table through REUSE_ALV_GRID_DISPLAY. 4. USER_COMMAND call back subroutine should be like this in your case. This is nowhere called using PERFORM statement in ur program. 5. USER_COMMAND subroutine should be like this.
*&---------------------------------------------------------------------*
*&      Form  user_command
*&---------------------------------------------------------------------*
form user_command using ucomm like sy-ucomm
                  *selfield* type slis_selfield.
  case ucomm .
    when '&IC1'. This is for double click on ALV output.
      skip 10.
      position 10.
      write 'Double click was executed'.
  endcase.
 
endform.                    "user_command
selfield structure You can also handle Interactive ALV using this structure.
types: begin of slis_selfield,
         tabname              type slis_tabname,
         tabindex             like sy-tabix,
         sumindex             like sy-tabix,
         endsum(1)            type c,
         sel_tab_field        type slis_sel_tab_field,
         value                type slis_entry,
         before_action(1)     type c,
         after_action(1)      type c,
         refresh(1)           type c,
         col_stable(1)        type c,
         row_stable(1)        type c,
*        colwidth_optimize(1) type c,
         exit(1)              type c,
         fieldname            type slis_fieldname,
         grouplevel           type i,
         collect_from         type i,
         collect_to           type i,
       end of slis_selfield.
You have to check the above structure in debug when u double click what the above contains. very helpful structure fo ur case. I will come up with example. I hope that it helps u . Regards, Venkat.O