Thursday, September 11, 2008

SAP Size of ALV Output, Columns, and Cells in SAP Netweaver

By default, the size of the ALV output, columns, and rows depends on their content. This means:

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

The ALV output 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 output and columns by specifying the required width. Decrease the width, however, is not as easy. First of all, you freeze the layout of the ALV output. 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:

Change the width

Change the height


You can only control the height of the rows using their content (for example, using the graphic size or multiline text).

Freeze 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 output

IF_SALV_WD_TABLE_SETTINGS

SET_WIDTH

Specify 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 output

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 output using the number of rows that are to be displayed at a time.


If the number of data records is less than the number of visible rows, empty rows are automatically appended to the end of the ALV output. You can specify that no empty rows are to be appended and that the height of the ALV output therefore adjusts itself according to the number of data records.

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


To display all data records of the internal data table, set the number of visible rows to -1.

Freezing the Table Layout

Freezing the layout of the ALV output 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

Freeze the table layout

SET_FIXED_TABLE_LAYOUT

Check whether table layout is frozen

GET_FIXED_TABLE_LAYOUT

No comments: