Show TOC

Assigning Properties to Columns and CellsLocate this document in the navigation structure

Use

You can assign most of the properties that affect the appearance of columns in the ALV output in the following ways:

  • You assign the property to the whole column and then every cells of the column gets this property.

  • In separate field in each cell, you specify how each cell is to appear in the current column. You then assign this field to the current column. This allows you to assign the required properties to cells individually.

You can assign the following properties like this:

  • Background color of a column (SET_CELL_DESIGN or SET_CELL_DESIGN_FIELDNAME)

  • Cell variant (SET_SELECTED_CELL_VARIANT or SET_SEL_CELL_VARIANT_FIELDNAME)

Cell Editor Properties

However, some properties for the appearances of a cell are connected with the cell editor that is used in the cell. This means the properties of the cell editor determine how a column is shown. The following applies to these properties too: They can be valid for all instances of the editor, or they can be overridden by information in another field.

Procedure

The following example shows how you can define the visibility of a button differently for individual rows of a column.

In a column, you are using the BUTTON cell editor. Each cell is displayed as a button. You want to hide some of the cells in this column. Since the visibility property is based on the button, and not the column, you have to use a workaround to hide the cell. This means that the BUTTON_VIS field determines in which cells of the column lr_column the button is visible.

  1. Create an object of class CL_SALV_WD_UIE_BUTTON (for example, lr_button ).

  2. A different field (for example, BUTTON_VIS) contains information for the visibility of each cell. You assign this field to the button lr_button :

    lr_button->set_visible_fieldname( ' BUTTON_VIS ' ).

  3. Assign this button to the column (for example, lr_column ) as a cell editor:

    lr_column->set_cell_editor( lr_button ).

Other examples of properties that you assign using the cell editor are:

  • Font type used in TEXT_VIEW (SET_DESIGN or SET_DESIGN_FIELDNAME)

  • Graphic for a selected toggle button (SET_CHECKED_IMAGE_SOURCE or SET_CHECKED_IMG_SRC_FIELDNAME)

  • Size of the progress bar in the ProgressIndicator (SET_PERCENT_VALUE or SET_PERCENT_VALUE_FIELDNAME)