Defining Column Width
You are able to change the width of the columns in the ALV output in different ways. Here you differentiate between columns in the content of the ALV output (represented by a COLUMN object) and other types of columns (such as hierarchy column of the tree structure, column in design object).
You are able to make the following settings for column width:
· Set output width of a column (COLUMN object)
· Set width of hierarchy column in the tree structure
· Change width of a column in table-type layout of a design object
· Adapt width to space needed for the values
· Hide column completely (section called Settings Visibility of a Column)
You are able to set the width of a column in the content of the ALV output no matter how large the field has been defined for the internal data table.
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 |
Methods
Function |
Class |
Method |
Set column width |
CL_SALV_COLUMN |
SET_OUTPUT_LENGTH |
Get column width |
GET_OUTPUT_LENGTH |
|
Get column width of the referenced data element |
GET_DDIC_OUTPUTLEN |
You are able to choose whether you want to specify the width of the hierarchy column in the tree structure in pixels or in characters.
Display type ALV Tool |
Classic ABAP list |
Full screen |
In the Container |
Simple, two-dimensional table |
No |
No |
No |
Hierarchical-sequential list |
No |
|
|
Tree structure |
|
Yes |
Yes |
Methods
Function |
Class |
Method |
Set whether the width of the hierarchy column is specified in characters or in pixels |
CL_SALV_ |
SET_HIERARCHY_SIZE_IN_PIXEL |
Check whether the width of the hierarchy column is specified in characters or in pixels |
IS_HIERARCHY_SIZE_IN_PIXEL |
|
Set width of hierarchy column |
SET_HIERARCHY_SIZE |
|
Get width of hierarchy column |
GET_HIERARCHY_SIZE |
If you use a table-type layout in a design object, you control the width of the column using its contents: the longer the text in a cell, the wider the column.
You are able to automatically set the width of columns so that all values are displayed completely by optimizing the column. You can make this setting for each column individually or for all columns simultaneously.
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 |
Methods
Function |
Class |
Method |
Optimize individual column |
CL_SALV_COLUMN |
SET_OPTIMIZED |
Check whether a column is optimized |
IS_OPTIMIZED |
|
Optimize all columns simultaneously |
CL_SALV_COLUMNS |
SET_OPTIMIZE |
Check whether all columns are optimized |
IS_OPTIMIZED |

In the printout, the columns that are output are exactly as wide as they are on the screen by default. In the full-screen display of a simple, two-dimensional table, you are able to determine that the column widths be optimized in the printout. To do this, use the method SET_COLUMN_OPTIMIZATION in the CL_SALV_PRINT class. With the IS_COLUMN_OPTIMIZATION you check whether the columns are optimized in the printout.