
In a layout, users are able to save information on column structure, sorting criteria, filter conditions and various display options, and so on. In this way, they are able to display their ALV outputs with the same properties every time.
You are able to use your application to affect the options that users have for using layouts.
You are not able to use the ALV object model to either create or delete layouts.
User-Specific Layout in Contrast to Layout for All Users
Layouts can be available to only one user or for all users of your application. Depending on that, the layout is designated as either a user-specific layout or a layout for all users.
You are able to determine whether users are allowed to save user-specific layouts or whether they are authorized to save layouts for all users as well.
User-specific layouts and layouts for all users also differ in their names:
The names of user-specific layouts start with a letter (A-Z).
The names of layouts for all users start with '/'.
The names of standard layouts provided by SAP start with a number (0-9).
Layout Key
All layouts for all applications are saved centrally. To enable a layout to be assignd to your application, set a layout key. All layouts that users save to your application can then be identified with this layout key and a name.
You are able to make the following settings for layouts:
Get Layouts
Set layout key
Determine for whom users can save layouts
Change Layout for Start of the ALV Output
Display Dialog Box for Layout
The following is valid for all of these functions:
|
ALV Tool |
Display type |
Function available |
|
Simple, Two-Dimensional Table |
Classic ABAP List |
Yes |
|
Fullscreen |
Yes |
|
|
In the Container |
Yes |
|
|
Hierarchical-sequential list |
Classic ABAP List |
Yes |
|
Tree structure |
Fullscreen |
Yes |
|
In the Container |
Yes |
Get Layouts
You are able to get the settings for layouts that users have saved for your application.
|
Function |
Class |
Method |
|
Get layout object |
CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE |
GET_LAYOUT |
|
Get settings for individual layouts |
CL_SALV_LAYOUT |
GET_LAYOUTS |
|
Get current layout |
GET_CURRENT_LAYOUT |
Set layout key
The layout key is a prerequisite for users are able to save a layout to your application. The layout key consists of the following information:
the name of your application
A key that uniquely identifies the output table within your application
A logical group for further specification (for example with multiple ALV instances in one program)
|
Function |
Class |
Method |
|
Set layout key |
CL_SALV_LAYOUT |
SET_KEY |
|
Get layout key |
GET_KEY |
Determine for whom users can save layouts
By default, users are not able to save layouts You are able to determine whether users can save layouts
Only for themselves (user-specific)
Only for other users (for all users)
For both themselves and for other users
Save them.
|
Function |
Class |
Method |
|
Determine for whom users can save layouts |
CL_SALV_LAYOUT |
SET_SAVE_RESTRICTION |
|
Check for whom users can save layouts |
GET_SAVE_RESTRICTION |
Change Layout for Start of the ALV Output
You have to ways of changing which layout will be used when the ALV output is started:
You allow the user to set one of the layouts as default. Depending on whether users choose a user-specific layout or one that is available to all users, the default is only valid for the user himself or for all users of the application.
You define a layout as initial layout. In this way, you override any defaults set up by the user.
|
Function |
Class |
Method |
|
Allow defaults |
CL_SALV_LAYOUT |
SET_DEFAULT |
|
Get layout that was set by a user as a default |
GET_DEFAULT_LAYOUT |
|
|
Checks whether the user has set a layout as default |
HAS_DEFAULT |
|
|
Set initial layout |
SET_INITIAL_LAYOUT |
|
|
Get initial layout |
GET_INITIAL_LAYOUT |
Display Dialog Box for Layout
You are able to display a dialog box that provides the user with a selection of layouts that are saved for your application.
|
Function |
Class |
Method |
|
Display dialog box |
CL_SALV_LAYOUT |
F4_LAYOUTS |