04-14-2008 7:00 PM
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.
04-15-2008 5:12 PM
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
04-14-2008 7:06 PM
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
04-15-2008 5:12 PM
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
04-15-2008 5:25 PM
Hi Ashish,
Here is the procedure to handle Interactive ALV.
1.
declare events table like this.
2.
Build events table .
data :
i_events type slis_t_event,
w_events like line of i_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.
w_events-name = 'USER_COMMAND' .
w_events-form = 'USER_COMMAND' .
append w_events to i_events.
clear w_events.
selfield structure
You can also handle Interactive ALV using this structure.
*&---------------------------------------------------------------------*
*& 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
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
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.