3 Replies Latest reply: Apr 15, 2008 6:25 PM by Venkat O RSS

Double click event in ALV

Ashish singh
Currently Being Moderated

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.

  • Re: Double click event in ALV
    Sujamol Augustine
    Currently Being Moderated

    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

  • Re: Double click event in ALV
    vasavi vanguru
    Currently Being Moderated

    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

  • Re: Double click event in ALV
    Venkat O
    Currently Being Moderated

    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

Actions