How to set Title and Zebra Pattern in ALV report

How to set Title and Zebra Pattern in ALV report

To change the display values or settings of ALV report we must use class CL_SALV_DISPLAY_SETTINGS.

The following methods are used to set the title and zebra pattern.

  • SET_LIST_HEADER
  • SET_STRIPED_PATTERN


REPORT ztest_alv.

DATA: lo_alv   TYPE REF TO cl_salv_table.

DATA: lo_display TYPE REF TO cl_salv_display_settings.

START-OF-SELECTION.

  SELECT * FROM spfli INTO TABLE @DATA(lt_spfli).

  IF sy-subrc IS INITIAL.

    cl_salv_table=>factory(
      IMPORTING
        r_salv_table   = lo_alv
      CHANGING
        t_table        = lt_spfli[]
    ).

    lo_display = lo_alv->get_display_settings( ). " Get display settings
    lo_display->set_list_header( value = 'Flight Report' ). " Report Title
    lo_display->set_striped_pattern( value = 'X' ).         " Zebra Pattern

    lo_alv->display( ).

  ENDIF.

Output:



Post a Comment

Previous Post Next Post