Thursday, 26 December 2013

Sample code for double click on output list using REUSE_ALV_GRID_DISPLAY , SAP or Interactive ALV

Do this:

  CALL FUNCTION 'REUSE_ALV_GRID_DISPLAY'
    EXPORTING
      i_callback_top_of_page  = 'TOP-OF-PAGE'
      i_grid_title            = 'Title goes here'
      i_callback_program      = program
      i_grid_settings         = grid_setting
      i_callback_user_command = 'DOUBLE_CLICK_ON_ALV'
      is_layout               = alv_layout
      it_fieldcat             = i_fieldcat_alv
    TABLES
      t_outtab                = itab.



FORM double_click_on_ALV USING r_ucomm LIKE sy-ucomm
                                  rs_selfield TYPE slis_selfield.

  READ TABLE itab INDEX rs_selfield-tabindex.

  " now you can do what ever you like
  " with the above read statement you have the exact line
  " that the user selected. 
  " from here you can call FB03 or perform any other funciton

ENDFORM.