To change the display settings of ALV object model (Class CL_SALV_TABLE) use class CL_SALV_DISPLAY_SETTINGS.
With the class CL_SALV_DISPLAY_SETTINGS, you can make settings that affect the appearance of the entire table. *&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: gt_spfli TYPE TABLE OF spfli.
DATA: gr_table TYPE REF TO cl_salv_table.
DATA: gr_display TYPE REF TO cl_salv_display_settings.
*&---------------------------------------------------------------------*
*& Start-of-Selection
*&---------------------------------------------------------------------*
START-OF-SELECTION.
SELECT * UP TO 10 ROWS FROM spfli INTO TABLE gt_spfli.
*Generate an instance of the ALV table object
CALL METHOD cl_salv_table=>factory
IMPORTING
r_salv_table = gr_table
CHANGING
t_table = gt_spfli.
*Get the reference to the settings of the table
gr_display = gr_table->get_display_settings( ).
*Set the striped pattern (ZEBRA pattern)
gr_display->set_striped_pattern( cl_salv_display_settings=>true ).
*Set the heading
gr_display->set_list_header( 'ALV Demo Program' ).
*Remove horizontal lines of the grid
gr_display->set_horizontal_lines( if_salv_c_bool_sap=>false ).
*Remove vertical lines of the grid
gr_display->set_vertical_lines( if_salv_c_bool_sap=>false ).
*Display the ALV table.
gr_table->display( ).
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com
Social Plugin