SAVE Default Layout in OOPS ALV CL_SALV_TABLE

When you create ALV using Class CL_SALV_TABLE, SAVE LAYOUT button is disabled.

To activate the button of saving layout you need to pass the below parameters,

lo_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).

Now something you need to set the saved layout as default, whenever program is run the set layout should be displayed.

cl_salv_table save layout

cl_salv_table=>factory(
IMPORTING
r_salv_table = lo_alv
CHANGING
t_table = gt_log ).

DATA: lo_cols TYPE REF TO cl_salv_columns,
lo_layout TYPE REF TO cl_salv_layout,
ls_key TYPE salv_s_layout_key..
lo_cols = lo_alv->get_columns( ).
lo_layout = lo_alv->get_layout( ).
lo_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).
ls_key-report = sy-repid.
lo_layout->set_key( ls_key ).