By default, each column in the ALV output has a column header. You do not therefore have to create the relevant objects first.
You can change column headers. In doing so, you can set up the following components:
● Text
● Graphic
● Tooltip
You can make the following settings for the column header:
● Create, get, and delete the object for the column header
● Specify the wording of the column header
● Specify the path of the graphic in the column header
● Specify the position of the graphic in the column header
● Specify the wording of the tooltip
Information About Standard Column Headers
Standard column headers contain text only. The wording used depends on the context node attribute:
● If the attribute has no DDIC reference:
By default, the system uses the technical name of the attribute as 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 as the column header.
Getting, Creating, and Deleting Objects for Column Headers
The column header of a column in your ALV output is an instance of class CL_SALV_WD_COLUMN_HEADER. A column header object can exist for every column object.
To get, create, or delete a column header object, you use the methods of class CL_SALV_WD_COLUMN.
Methods for Getting, Creating, and Deleting Column Headers
Function | Method |
Get column header object | GET_HEADER |
Create column header object | CREATE_HEADER |
Delete column header object | DELETE_HEADER |
Specifying the Wording of the Column Header
You can specify the text to be displayed as the column header. You have the following options:
● You can enter user-defined 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. You 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.
If you enter user-defined text as the column header, you must use this method to explicitly deactivate the DDIC relationship.
To specify the wording of the column header, you use the methods of class CL_SALV_WD_COLUMN_HEADER.
Methods for the Wording of Column Headers
Function | Method |
Specify any text as the column header Explicitly deactivate DDIC relationship | SET_TEXT SET_PROP_DDIC_BINDING_FIELD |
Get the wording for the column header | GET_TEXT |
Specify the DDIC data element whose field label is to be used as the column header | SET_PROP_DDIC_BINDING_ELEMENT |
Get the name of the DDIC data element | GET_ PROP_DDIC_BINDING_ELEMENT |
Specify the type of field label to be used as the column header | SET_ PROP_DDIC_BINDING_FIELD |
Get the type of field label to be used as the column header | GET_ PROP_DDIC_BINDING_FIELD |
Line Breaks in Column Headers
By default, the system does not add line breaks in the column header. The width of the column is therefore determined by the length of the text in the column header. You can specify that line breaks are to be permitted in the column header. 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, you use the methods of 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 specify the path or ID of the graphic file, you use the methods of class CL_SALV_WD_COLUMN_HEADER.
Methods for Specifying Paths of Graphic Files
Function | Method |
Specify 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 the graphic you display in a column header is to be placed before or after the text for the column header. To do this, you use the methods of class CL_SALV_WD_COLUMN_HEADER.
Methods for Positioning Graphics in Headers
Function | Method |
Specify position within header | SET_IMAGE_FIRST |
Get position within header | GET_IMAGE_FIRST |
Specifying the Wording of the Tooltip
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 any 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. You 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.
If you enter user-defined text as the tooltip, you must explicitly deactivate the DDIC relationship using this method.
To specify the wording of the tooltip, you use the methods of 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 the wording for the tooltip | GET_TOOLTIP |
Specify the DDIC data element whose field label is to be used as the tooltip | SET_PROP_DDIC_BINDING_ELEMENT |
Get the 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 |
No comments:
Post a Comment