SAP WRITE LIST ELEMENTS ABAP Statements



Get Example source ABAP code based on a different SAP table
  


• AS CHECKBOX WRITE
• AS ICON WRITE
• AS SYMBOL WRITE
• AS LINE WRITE

WRITE, list_elements
Short Reference

ABAP_SYNTAX
ABAP_KEY ... ${AS CHECKBOX$}
$| ${AS ICON$}
$| ${AS SYMBOL$}
$| ${AS LINE$} ...

ABAP_ALTERNATIVES:
1 ... AS CHECKBOX
2 ... AS ICON
3 ... AS SYMBOL
4 ... AS LINE

What does it do?
These additions are used to represent special list elements.
The data object dobj in the output must have certain properties. The additions cannot be used together. If they are used with the additions for internal formats and external formats, they can only be used to a limited extent.

ABAP Alternative 1 ... AS CHECKBOX

What does it do?
The output of this addition is a single-character checkbox that is ready for input. dobj expects a character-like data type of length 1. If the first character in dobj is X or x, the checkbox is shown as selected. If the first character is not X or x, the checkbox is shown as empty. If dobj is an empty data object of the type string, the checkbox is not output.
The user can select and deselect the checkbox in the list displayed on the window. If the user selects the checkbox, the first character of the assigned field in the list is set to X . If the user deselects it, it is set to blank. The change is stored in the list buffer and can be evaluated during a list event.
If the addition AS CHECKBOX is used, no list output len is allowed after AT. Except for INPUT, NO-GAP, and UNDER, the other additions specified at the same time for internal formats and external formats are ignored.
The addition AS CHECKBOX has the same effect as specifying the addition INPUT ON simultaneously. The standard settings or a format INPUT OFF set by a FORMAT statement are overridden for the current WRITE statement. To make the checkbox not ready for input, the addition INPUT OFF must be used simultaneously.



Latest notes:

If a list line contains only a checkbox with a blank, it is displayed only if the statement SET BLANK LINES ON is executed beforehand.
By default, addition HOTSPOT ON has no effect on a checkbox. HOTSPOT ON only has an effect if INPUT OFF is deactivated.
ABAP_HINT_END



Example ABAP Coding

Output of two checkbox fields and evaluation of the user input in the event AT LINE-SELECTION.
ABEXA 00784
ABAP_EXAMPLE_END

ABAP Alternative 2 ... AS ICON

What does it do?
This addition produces icons. It should be noted that not all icons are suitable for spool lists. dobj expects data objects of the type c whose initial characters can be interpreted as the internal ID of an icon by the runtime framework.
In the type pool ICON, a constant is declared for each icon that can be displayed. The names of the constants can be taken from the type pool or the output of the SHOWICON program. This program also shows the corresponding output length and whether an icon can be spooled or not.
If the content of dobj cannot be interpreted as an icon or the content is changed by simultaneous use of other additions for internal formats or external formats, blanks are produced instead of icons.



Latest notes:

None of the additions from the internal formats and external formats are forbidden. When using these additions, care must be taken that the content of dobj can be interpreted as an icon.
The output length is determined, as usual, either implicitly using the data type of dobj or by being specified explicitly. Characters in the output area that do not have the icon are filled with blanks.
The database table ICONT contains descriptive texts for the icons.
The program SHOWICON shows two internal IDs for each icon:
A two-digit hexadecimal number as the key.
A six-character string composed of uppercase letters and any underscores as the internal name. If a character string that is output using WRITE has an internal ID of this type between two @ characters at the start, this is represented as an icon in the list output, even without the addition AS ICON. This can lead to unwanted output of icons and unexpected effects in terms of the output length. By default, the output length is determined by the length of the character string. However, this property can also be exploited, for example, to use icons at the start of text symbols. IDs that are not at the start are not represented as icons.
ABAP_HINT_END



Example ABAP Coding

Displays a traffic light icon.
ABEXA 00785
ABAP_EXAMPLE_END



Example ABAP Coding

Displaying traffic light icons using their internal IDs (key and internal name). The IDs that are not at the start of the character string are not converted.
ABEXA 00786
ABAP_EXAMPLE_END

ABAP Alternative 3 ... AS SYMBOL

What does it do?
This addition produces all characters of the data object dobj as symbols. The type pool SYM declares constants with a length of 1 for each character that can be displayed as a symbol, and whose name reflects the meaning of the symbol. The names of the constants and the meaning and length of the symbols can be taken from the type pool or from the output of the program SHOWSYMB.



Latest notes:

The output length is determined, as usual, either implicitly using the data type of dobj or by being specified explicitly.
ABAP_HINT_END



Example ABAP Coding

Displays a hand symbol.
ABEXA 00787
ABAP_EXAMPLE_END

ABAP Alternative 4 ... AS LINE

What does it do?
This addition produces line elements with the output length 1. Line elements are corners, crosses, lines, and T sections. dobj expects data objects of the type c whose content can be interpreted as line elements by the runtime framework. The type pool LINE declares the line element constants displayed in the following table. ConstantMeaning line_spaceBlank line_top_left_cornerTop left corner line_bottom_left_cornerBottom left corner line_top_right_cornerTop right corner line_bottom_right_cornerBottom right corner line_horizontal_lineHorizontal line line_vertical_lineVertical line line_left_middle_cornerT section turned to the left line_right_middle_cornerT section turned to the right line_bottom_middle_cornerReversed T section line_top_middle_cornerT section line_crossCross
If dobj has different content or the content is changed by simultaneous use of other additions for internal formats, a blank is produced instead of a line element. The addition FRAMES OFF must not be specified simultaneously. The other additions for external formats and QUICKINFO are ignored in the output of line elements.



Latest notes:

The characters - and | and produced using ULINE are joined with each other by default, if no other characters exist between them. Here the system replaces the characters by the above line elements. A solitary character | is always replaced by a vertical line. The - characters from sy-uline are always replaced by a horizontal line. The default behavior can be switched off using the addition FRAMES OFF.
The addition AS LINE is used to output line elements in the exact way they are defined. Links are produced only where line elements actually meet each other. The system does not, however, create any automatic extensions between the characters - or | and line elements produced explicitly using AS LINE.
ABAP_HINT_END



Example ABAP Coding

Produces four adjoining rectangles.
ABEXA 00788
ABAP_EXAMPLE_END

Return to menu