Thursday, September 11, 2008

SAP Assigning Properties to Columns and Cells in SAP Netweaver

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 entire column.

Each cell in the column then has 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

Some properties that influence the appearance of a cell are connected to the cell editor used in the cell. This means that the properties of the cell editor determine how a column is displayed. These properties can be valid for all instances of the editor, or they can be overridden by information in another field.

Example

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:

You create an object of class CL_SALV_WD_UIE_BUTTON (for example, lr_button).

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 ' ).

You then assign the button to the column (for example, lr_column) as a cell editor:

lr_column->set_cell_editor( lr_button ).

This means that the BUTTON_VIS field determines in which cells of the column lr_column the button is visible.

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)

The options for this procedure depend on which UI element the cell editor is handling.

No comments: