-
Book Overview & Buying
-
Table Of Contents
SAP ABAP Advanced Cookbook
By :
Up to this point, the output of the ALV does not allow the user to save changes made to layout. In this recipe, we will add coding that will allow saving user-specific layouts, load layouts, as well as specify a default layout.
For enabling layout saving, follow these steps:
We declare two variables and also, an object reference to the class cl_salv_layout. In addition, a key is defined based on the type salv_s_layout_key.
The get_layout method is then used to get the layout object for the ALV.
The set_key method is called for the layout object mylayout. The mykey structure having the report name sy-repid is passed to this method.
Next, the set_save_restriction method is called. It is passed the static attribute RESTRICT_USER_DEPENDANT of the interface if_salv_c_layout.
Finally, the set_default layout method is called with the value 'X', as shown in the next screenshot.

The code is added before the ALV display method call shown in the first screenshot...
Change the font size
Change margin width
Change background colour