Show TOC

Background documentationColumn Headers Locate this document in the navigation structure

 

By default, each column in the ALV output has a column header. You do not have to generate the objects in question first.

You can change a column header. To do this, you can set up the following component parts:

  • Text

  • Graphic

  • Tooltip

You can make the following settings for the column header:

  • Generate, get, and delete object for column header

  • Specify the wording of the column header

  • Determine whether line breaks are possible in the column header

  • Specify the path to the graphic in the column header

  • Specify the position of the graphic in the column header

  • Specify the wording for the tooltip

Information on Standard Column Headers

Standard column headers only contain text. The wording depends on the context node attribute:

  • If the attribute has no DDIC reference:

    By default, the system uses the technical name of the attribute for the column header.

  • If the attribute has a DDIC reference:

    The system assigns column headers as follows:

    • If field labels have been defined for the DDIC data element, the system uses the short text of the DDIC data element as the column header.

    • If no field labels have been defined, the system uses the technical name of the DDIC data element.

Generating, Getting, and Deleting Objects for Column Headers

The column header of a column in your ALV output is an instance of the class CL_SALV_WD_COLUMN_HEADER. A column header object can exist for every column object.

To get, generate, or delete a column header object, use the methods of the class CL_SALV_WD_COLUMN.

Methods for getting, generating, and deleting column headers

Function

Method

Get column header object

GET_HEADER

Generate column header object

CREATE_HEADER

Delete column header object

DELETE_HEADER

Specifying the Wording of the Column Header

You can define the text to be displayed as a column header. You have the following options:

  • You can enter free text.

  • You can enter a separate DDIC data element whose field label is to be used as the column header.

For a DDIC relationship, you first of all enter the DDIC data element that returns the wording of the column header. You do this using method SET_PROP_DDIC_BINDING_ELEMENT. Make the following entries:

  • Column header or tooltip

    The text from the DDIC is to be used here as the column header.

  • Name of the DDIC data element

If you do not make any further entries, the short text of the DDIC data element is used. You can also use the heading, medium text, or long text of the DDIC data element. You do this using method SET_PROP_DDIC_BINDING_FIELD.

Note Note

If you enter user-defined text as the column header, you must use this method to explicitly deactivate the DDIC relationship.

End of the note.

To specify the wording of the column header, use the methods of the class CL_SALV_WD_COLUMN_HEADER.

Methods for the wording of column headers

Function

Method

Define free text as column header

Explicitly deactivate DDIC relationship

SET_TEXT

SET_PROP_DDIC_BINDING_FIELD

Get wording for column header

GET_TEXT

Specify DDIC data element whose field label is to be used as the column header

SET_PROP_DDIC_BINDING_ELEMENT

Get name of the DDIC data element

GET_ PROP_DDIC_BINDING_ELEMENT

Specify type of field label to be used as column header

SET_ PROP_DDIC_BINDING_FIELD

Get type of field label to be used as column header

GET_ PROP_DDIC_BINDING_FIELD

Line Breaks in Column Headers

The system does not generally add line breaks in the column header. By default, the width of the column is determined by the text length in the column header. You can specify that line breaks are to be permitted in the column header.

Note Note

To put a line break in a column header, the table layout has to be fixed for the ALV output (see also Size of ALV Output, Columns, and Cells).

End of the note.

If the column header contains characters that permit line breaks (such as spaces or hyphens) and the column is not wide enough, the system can spread the text across multiple lines. To do this, use the methods of the class CL_SALV_WD_COLUMN_HEADER.

Methods for Line Breaks in Column Headers

Function

Method

Set line breaks

SET_HEADER_TEXT_WRAPPING

Determine whether line breaks are set in the column header

GET_HEADER_TEXT_WRAPPING

Specifying the Path of the Graphic in the Column Header

You can display any graphic in a column header as long as it is suitable for the Web Dynpro environment (see Handling Web Icons). To define the path or ID of the graphic file, use the methods of the class CL_SALV_WD_COLUMN_HEADER.

Methods for defining paths of graphic files

Function

Method

Set path or ID for graphic

SET_IMAGE_SOURCE

Get path or ID for graphic

GET_IMAGE_SOURCE

Specifying the Position of the Graphic in the Column Header

You can choose whether graphics displayed in column headers are placed before or after the text. To do this, use the methods of the class CL_SALV_WD_COLUMN_HEADER.

Methods for placing graphics in headers

Function

Method

Set position within header

SET_IMAGE_FIRST

Get position within header

GET_IMAGE_FIRST

Specifying the Wording for Tooltips

The tooltip of a column header is displayed when the user places the cursor over the column header.

You can specify the text to be displayed as the tooltip. You have the following options:

  • You can enter free text.

  • You can enter a separate DDIC data element whose field label is to be used as the tooltip.

For a DDIC relationship, you first of all enter the DDIC data element that returns the wording of the tooltip. You do this using method SET_PROP_DDIC_BINDING_ELEMENT. Make the following entries:

  • Column header or tooltip

    The text from the DDIC is to be used here for the tooltip.

  • Name of the DDIC data element

If you do not make any further entries, the short text of the DDIC data element is used. You can also use the heading, medium text, or long text of the DDIC data element. You do this using method SET_PROP_DDIC_BINDING_FIELD.

Note Note

If you enter user-defined text as the tooltip, you must explicitly deactivate the DDIC relationship using this method.

End of the note.

To specify the wording of tooltips, use the methods of the class CL_SALV_WD_COLUMN_HEADER.

Methods for the wording of tooltips

Function

Method

Specify any text as the tooltip

Explicitly deactivate DDIC relationship

SET_TOOLTIP

SET_PROP_DDIC_BINDING_FIELD

Get wording for tooltip

GET_TOOLTIP

Specify the DDIC data element whose field label is to be used as the tooltip

SET_PROP_DDIC_BINDING_ELEMENT

Get name of the DDIC data element

GET_ PROP_DDIC_BINDING_ELEMENT

Specify the type of field label to be used as the tooltip

SET_ PROP_DDIC_BINDING_FIELD

Get the type of field label to be used as the tooltip

GET_ PROP_DDIC_BINDING_FIELD