Users are able to save the following settings for their output table as layouts:
- Which columns from the column set they wish to display and in what position
- Which of the columns that can be aggregated they wish to total
- Which columns in the output table are used to sort
- Which filter should be used
*&---------------------------------------------------------------------*
*& Data Declaration
*&---------------------------------------------------------------------*
DATA: gt_spfli TYPE TABLE OF spfli.
DATA: gr_table TYPE REF TO cl_salv_table.
DATA: gr_functions TYPE REF TO cl_salv_functions_list.
DATA: gr_layout TYPE REF TO cl_salv_layout.
DATA: g_key TYPE salv_s_layout_key.
*&---------------------------------------------------------------------*
*& 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 ALV toolbar functions
gr_functions = gr_table->get_functions( ).
**Set all toolbar functions
gr_functions->set_all( abap_true ).
**Manage ALV layouts
gr_layout = gr_table->get_layout( ).
g_key-report = sy-repid.
gr_layout->set_key( g_key ).
*Set proper restriction for saving the layouts
gr_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
**Display the ALV table.
gr_table->display( ).
Serkan AKKAVAK
Computer Engineer
ABAP Developer & SAP MM SD Consultant
Contact : serkurumsal@yandex.com
Social Plugin