Events in the object oriented ALV based on class CL_SALV_TABLE

The ALV based on class CL_SALV_TABLE fires fewer events than ALV based on CL_GUI_ALV_GRID. The class CL_SALV_TABLE doesn't support editable fields, so there are no events for changed data and etc.

If you want to use your own button on the toolbar, copy and extend the standard GUI status STANDARD_FULLSCREEN of the program SAPLSLVC_FULLSCREEN. The related event with a click on own function is event ADDED_FUNCTION.
Below a sample program to trace the events calls.
PROGRAM zkmalve2.

DATA:
  gt_usr   TYPE TABLE OF usr02,
  gs_usr   TYPE usr02.

*----------------------------------------------------------------------*
*       CLASS cl_event_handler DEFINITION
*----------------------------------------------------------------------*
CLASS cl_event_handler DEFINITION.

  PUBLIC SECTION.

    CLASS-METHODS on_before_salv_function         " BEFORE_SALV_FUNCTION
      FOR EVENT if_salv_events_functions~before_salv_function
        OF cl_salv_events_table
          IMPORTING e_salv_function.

    CLASS-METHODS on_after_salv_function          " AFTER_SALV_FUNCTION
      FOR EVENT if_salv_events_functions~before_salv_function
        OF cl_salv_events_table
          IMPORTING e_salv_function.

    CLASS-METHODS on_added_function               " ADDED_FUNCTION
      FOR EVENT if_salv_events_functions~added_function
        OF cl_salv_events_table
          IMPORTING e_salv_function.

    CLASS-METHODS on_top_of_page                  " TOP_OF_PAGE
      FOR EVENT if_salv_events_list~top_of_page
        OF cl_salv_events_table
          IMPORTING r_top_of_page
                    page
                    table_index.

    CLASS-METHODS on_end_of_page                  " END_OF_PAGE
      FOR EVENT if_salv_events_list~end_of_page
        OF cl_salv_events_table
          IMPORTING r_end_of_page
                    page.

    CLASS-METHODS on_double_click                 " DOUBLE_CLICK
      FOR EVENT if_salv_events_actions_table~double_click
        OF cl_salv_events_table
          IMPORTING row
                    column.

    CLASS-METHODS on_link_click                   " LINK_CLICK
      FOR EVENT if_salv_events_actions_table~link_click
        OF cl_salv_events_table
          IMPORTING row
                    column.
ENDCLASS.                    "cl_event_handler DEFINITION

*----------------------------------------------------------------------*
*       CLASS cl_event_handler IMPLEMENTATION
*----------------------------------------------------------------------*
CLASS cl_event_handler IMPLEMENTATION.

  METHOD on_before_salv_function.
    BREAK-POINT.
  ENDMETHOD.                    "on_before_salv_function

  METHOD on_after_salv_function.
    BREAK-POINT.
  ENDMETHOD.                    "on_after_salv_function

  METHOD on_added_function.
    BREAK-POINT.
  ENDMETHOD.                    "on_added_function

  METHOD on_top_of_page.
    BREAK-POINT.
  ENDMETHOD.                    "on_top_of_page

  METHOD on_end_of_page.
    BREAK-POINT.
  ENDMETHOD.                    "on_end_of_page

  METHOD on_double_click.
    BREAK-POINT.
  ENDMETHOD.                    "on_double_click

  METHOD on_link_click.
    BREAK-POINT.
  ENDMETHOD.                    "on_link_click
ENDCLASS.                    "cl_event_handler IMPLEMENTATION

*&---------------------------------------------------------------------*
*&      START-OF-SELECTION
*&---------------------------------------------------------------------*
START-OF-SELECTION.

* read sample data to internal table
  SELECT * FROM usr02 UP TO 30 ROWS
    APPENDING CORRESPONDING FIELDS OF TABLE gt_usr
    ORDER BY bname.

  PERFORM display_alv.

*&---------------------------------------------------------------------*
*&      Form  display_alv
*&---------------------------------------------------------------------*
FORM display_alv.

  DATA:
    lo_table      TYPE REF TO cl_salv_table,
    lo_events     TYPE REF TO cl_salv_events_table,
    lo_columns    TYPE REF TO cl_salv_columns_table,
    lo_column     TYPE REF TO cl_salv_column_list.

  TRY.
      CALL METHOD cl_salv_table=>factory
        IMPORTING
          r_salv_table = lo_table
        CHANGING
          t_table      = gt_usr.

      lo_events = lo_table->get_event( ).
      SET HANDLER cl_event_handler=>on_before_salv_function FOR lo_events.
      SET HANDLER cl_event_handler=>on_after_salv_function FOR lo_events.
      SET HANDLER cl_event_handler=>on_added_function FOR lo_events.
      SET HANDLER cl_event_handler=>on_top_of_page FOR lo_events.
      SET HANDLER cl_event_handler=>on_end_of_page FOR lo_events.
      SET HANDLER cl_event_handler=>on_double_click FOR lo_events.
      SET HANDLER cl_event_handler=>on_link_click FOR lo_events.

*     ALV-Toolbar
      lo_table->set_screen_status(
        pfstatus      = 'STANDARD_FULLSCREEN'
        report        = 'SAPLSLVC_FULLSCREEN'
        set_functions = lo_table->c_functions_all ).

*     Set column as hotspot
      lo_columns = lo_table->get_columns( ).
      lo_column ?= lo_columns->get_column( 'BNAME' ).
      lo_column->set_cell_type( if_salv_c_cell_type=>hotspot ).

      lo_table->display( ).

    CATCH cx_salv_msg.             " cl_salv_table=>factory()
      WRITE: / 'cx_salv_msg exception'.
      STOP.
    CATCH cx_salv_not_found.       " cl_salv_columns_table->get_column()
      WRITE: / 'cx_salv_not_found exception'.
      STOP.
  ENDTRY.
ENDFORM.                    "display_alv
See other related notes in my infodepot:
Events in the object oriented ALV based on class CL_GUI_ALV_GRID Reference on the local internal table from event handler in object oriented ALV Events in ALV tree based on class CL_SALV_TREE
Full list of examples in my infodepot

If you have a question, have found an error or just want to contact me, please use this form.

Copyright (C) 2010 http://www.kerum.pl/infodepot/

Disclaimer: I am not affiliated or related to any division or subsidiary of SAP AG.
Trademarks or registered trademarks of any products or companies referred to on this site belong to those companies.
Anyone using the given solutions, is doing it under his/her own responsibility and at own risk.