[ABAP] SALV-Table – Benutzerspezifisches Layout setzen 2

DATA: o_alv TYPE REF TO cl_salv_table.
DATA: lv_layout_key TYPE salv_s_layout_key.
  
PARAMETERS: p_alvlay TYPE slis_vari.

AT SELECTION-SCREEN ON VALUE-REQUEST FOR p_alvlay.
  lv_layout_key-report = sy-repid.
  p_alvlay = cl_salv_layout_service=>f4_layouts( lv_layout_key )-layout.

START-OF-SELECTION.
  DATA: o_alv_layout TYPE REF TO cl_salv_layout.

  ...

  lv_layout_key-report = sy-repid.
  o_alv_layout = o_alv->get_layout( ).
  o_alv_layout->set_key( lv_layout_key ).
  o_alv_layout->set_initial_layout( p_alvlay ).

[ABAP] SALV-Table – Benutzerspezifisches Layout setzen

DATA: o_alv TYPE REF TO cl_salv_table.

...

* Benutzerspezifische Layouts aktivieren
DATA: o_alv_layout TYPE REF TO cl_salv_layout,
      lv_layout_key TYPE salv_s_layout_key.
      
lv_layout_key-report = sy-repid.
o_alv_layout = o_alv->get_layout( ).
o_alv_layout->set_key( lv_layout_key ).
o_alv_layout->set_save_restriction( if_salv_c_layout=>restrict_none ).