ABAP Code Examples

Simple ALV report using CL_SALV_TABLE class ABAP Code




*& TITLE: Simple ALV report using CL_SALV_TABLE class
*&-------------------------------*
*& Report  ZALV_SIMPLE
*&-------------------------------*
*& Output very simple ALV report using CL_SALV_TABLE class
*&-------------------------------*
REPORT ZALV_SIMPLE.

DATA: it_report TYPE TABLE OF sflight.
DATA: salv_table TYPE REF TO   cl_salv_table.

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

* Select data from database table SFLIGHT
  SELECT *
   UP TO 20 ROWS
    from SFLIGHT
    INTO TABLE it_report.

* Create an instance of the SALV table object
  CALL METHOD cl_salv_table=>factory
    EXPORTING
      list_display = if_salv_c_bool_sap=>false
    IMPORTING
      r_salv_table = salv_table
    CHANGING
      t_table      = it_report.


*----------------
END-OF-SELECTION.

* Output ALV report to user
  salv_table->display( ).

Text pool values