Size of ALV Display, Columns, and Cells

Use

By default, the size of the ALV display, columns, and rows depends on their content. In other words:

  • A column is at least as wide as its widest cell.

  • The ALV display is at least as wide as all its columns together.

  • A row is at least as high as its highest cell.

You can easily increase the width of the ALV display and columns by specifying the required width. Decreasing the width, however, is not as easy. First of all, you freeze the layout of the ALV display. This assigns the same width to all columns. You can then specify the required width for each column. You can make the following settings for the size of the individual areas:

  • Changing the Width

  • Changing the Height

  • Freezing the Table Layout

Changing the Width

To change the width of an area, you use the methods of the classes for the areas.

Methods for changing the width

Function

Class

Method

Specify width of ALV display

IF_SALV_WD_TABLE_SETTINGS

SET_WIDTH

Specifying Width of Column

CL_SALV_WD_COLUMN

Specify width of business graphic

IF_SALV_WD_GRAPHIC_SETTINGS

Specify width of cell

Only with the following cell editors:

SET_WIDTH or SET_WIDTH_FIELDNAME

Button

CL_SALV_WD_UIE_BUTTON

Dropdown list box

CL_SALV_WD_UIE_DROPDOWN_

BY_KEY

Image

CL_SALV_WD_UIE_IMAGE

InputField

CL_SALV_WD_UIE_INPUT_FIELD

ProgressIndicator

CL_SALV_WD_UIE_PROGR_

INDICATOR

ToggleButton

CL_SALV_WD_UIE_TOGGLE_

BUTTON

ValueComparison

CL_SALV_WD_UIE_VALUE_CMP

Get width of ALV display

IF_SALV_WD_TABLE_SETTINGS

GET_WIDTH

Get width of column

CL_SALV_WD_COLUMN

Get width of business graphic

IF_SALV_WD_GRAPHIC_SETTINGS

Get width of cell (only with cell editors listed above)

GET_WIDTH or GET_WIDTH_FIELDNAME

Changing the Height

You specify the height of the ALV display using the number of rows that are to be displayed at a time.

To do this, you use the methods of interface class IF_SALV_WD_TABLE_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for changing the height

Function

Method

Specify number of visible rows

SET_VISIBLE_ROW_COUNT

Get number of visible rows

GET_VISIBLE_ROW_COUNT

Append empty rows

SET_DISPLAY_EMPTY_ROWS

Check whether empty rows are appended

GET_DISPLAY_EMPTY_ROWS

Freezing the Table Layout

Freezing the layout of the ALV display can be used to make columns narrower than their content dictates.

To do this, you use the methods of interface class IF_SALV_WD_TABLE_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE).

Methods for freezing the table layout

Function

Method

Freezing the Table Layout

SET_FIXED_TABLE_LAYOUT

Check whether table layout is frozen

GET_FIXED_TABLE_LAYOUT

Define the behavior of the table when changing the column width

If the user changes the width of a column, the width of the other columns is automatically adjusted so that the width of the table remains the same. You can define that the width of the other columns does not change or the columns can be controlled by horizontal scrolling.

To do this, you use the methods of interface class IF_SALV_WD_TABLE_SETTINGS (implementing class CL_SALV_WD_CONFIG_TABLE).

Function

Method

Define if the width of the other columns is adjusted

SET_COLUMN_RESIZE_MODE

Check if the width of the other columns is adjusted

GET_COLUMN_RESIZE_MODE

The COLUMN_RESIZE_MODE property has two values:

  • PreserveTableWidth (default)

    If the user changes the width of a column, the width of all other columns is also affected.

  • PreserveOtherColumnWidths

    If the user changes the width of a column, the width of all other columns remains constant. If the sum of all column widths is larger than the width of the entire table, horizontal scrollingon the client is enabled.

    Some prerequisites and conditions apply for this setting. For more information, see Table Properties