Columns (General)
Definition
Columns are the main element of an ALV output. You can define a number of properties for a column to change whether and how a value is displayed in the column.
Column Description
In the ALV object model, a COLUMN object (class CL_SALV_COLUMN) is generated automatically for every column in your internal data table. All of the COLUMN objects are represented by the COLUMN object (class CL_SALV_COLUMNS and its subclasses).
During generation of table instances, the ALV object model determines all relevant and available properties from the DDIC description of your internal data table and assigns them to the individual column objects.
With the methods for class CL_SALV_COLUMN (or its subclasses), you define more properties as needed. The following graphic shows the inheritance hierarchy of a column object:
Column Types
You are able to differentiate between the following column types:
-
Standard columns
-
Lead columns, which are columns that have a special textual meaning in your ALV output.
-
Special columns that control the meaning or display of other columns or that are reserved for special functions
Some of the settings that you make for a column are valid for all of these column types, but some are only reserved for a specific type of column.
Use
You are able to make the following settings for all columns.
-
Set the visibility of the column
-
Change Position of the Column within the ALV Output
Get Column Objects
The GET_COLUMNS method exists in each ALV main class. It returns the column descriptions of all columns in the ALV output (all column objects). You use this object (class CL_SALV_COLUMNS) and the GET method or GET_COLUMN methods to get the desired column description.
|
Function |
Class |
Method |
|---|---|---|
|
Get all column objects |
CL_SALV_TABLE CL_SALV_HIERSEQ_TABLE CL_SALV_TREE |
GET_COLUMNS |
|
CL_SALV_COLUMNS |
GET |
|
|
Get all column objects for a hierarchy level |
CL_SALV_HIERSEQ_LEVEL |
GET_COLUMNS |
|
Get specific column object |
CL_SALV_COLUMNS |
GET_COLUMN |
|
Get technical name of the current column |
CL_SALV_COLUMNCL_SALV_ITEMCL_SALV_AGGREGATIONCL_SALV_SORT |
GET_COLUMNNAME |
Set the Visibility of the Column
The column set of users are made up of columns that they can hide and display as needed. You have various options for influencing a user’s column set:
-
You determine which columns users are shown when the ALV output appears on the screen. This setting is a standard setting.
-
You determine which columns are contained in the column set, but are not being displayed on the screen: You set the column as hidden.
-
You are able to determine which columns should not be included in the user's column set: You define the column as a technical column.
Display type
ALV Tool
Classic ABAP list
Full screen
In the Container
Simple, two-dimensional table
Yes
Yes
Yes
Hierarchical-sequential list
Yes
Tree structure
Yes
Yes
Function
Class
Method
Set the visibility of a column
CL_SALV_COLUMN
SET_VISIBLE
Check setting for visibility
IS_VISIBLE
Define column as technical column
SET_TECHNICAL
Check whether column is a technical column
IS_TECHNICAL
Change Position of the Column within the ALV Output
You are able to change the sequence of the columns within the ALV output.
|
Display type ALV Tool |
Classic ABAP list |
Full screen |
In the Container |
|
Simple, two-dimensional table |
Yes |
Yes |
Yes |
|
Hierarchical-sequential list |
Yes |
||
|
Tree structure |
Yes |
Yes |
|
Function |
Class |
Method |
|---|---|---|
|
Change the position of a column |
CL_SALV_COLUMNS |
SET_COLUMN_POSITION |
|
Get current position of a column |
GET_COLUMN_POSITION |