2018 Sep 12 3:56 AM
Dear all experts,
I have developed an ALV report by using cl_salv_table and the screen of Save Layout as this figure
I want to make User-Specific grey-out. How to get it? Please help me.
Dai Nguyen Quang,
Thanks.
2018 Sep 12 9:11 AM
let's say that your SALV object is ob_salv_table, then you just have to call :
ob_salv_table->get_layout( )->set_save_restriction( if_salv_c_layout=>restrict_user_independant ).
2018 Sep 12 7:47 AM
It's a quite common question, already asked dozens of times: did you searched for it?
Because if you had done it, googling "cl_salv_table layout save user only" (or just checking CL_SALV_TABLE Wiki) you had found that the layout is handled by object CL_SALV_LAYOUT with all the options you need.
2018 Sep 12 10:56 AM
2018 Sep 12 9:11 AM
let's say that your SALV object is ob_salv_table, then you just have to call :
ob_salv_table->get_layout( )->set_save_restriction( if_salv_c_layout=>restrict_user_independant ).
2018 Sep 12 10:53 AM
Thank you very much.
METHOD SET_LAYOUT.
*
DATA: LO_LAYOUT TYPE REF TO CL_SALV_LAYOUT,
LF_VARIANT TYPE SLIS_VARI,
LS_KEY TYPE SALV_S_LAYOUT_KEY.
*
* get layout object
LO_LAYOUT = CO_ALV->GET_LAYOUT( ).
*
* set Layout save restriction
* 1. Set Layout Key .. Unique key identifies the Differenet ALVs
LS_KEY-REPORT = SY-REPID.
LO_LAYOUT->SET_KEY( LS_KEY ).
* 2. Remove Save layout the restriction.
LO_LAYOUT->SET_SAVE_RESTRICTION( IF_SALV_C_LAYOUT=>RESTRICT_USER_INDEPENDANT ).
LO_LAYOUT->SET_DEFAULT( 'X' ).
*
* set initial Layout
* LF_VARIANT = 'DEFAULT'.
* LO_LAYOUT->SET_INITIAL_LAYOUT( LF_VARIANT ).
*
ENDMETHOD. "set_layout