The basic ABAP statement for displaying data on the screen is WRITE .
WRITE f .
This statement writes field f to the current list in its standard output format. By default, the list is displayed on the screen.
Field f can be
Any data object (see Data Objects )
A field symbol or formal parameter (see Working with Field Symbols ).
A text symbol (see Maintaining Text Elements )
You can print the current output list directly from the output screen by choosing Print .
If a selection screen is defined for the program (see Selection Screens ), you can choose Execute and print on the selection screen . Then, the list is not displayed on the screen, but sent directly to a printer.
WRITE 'Hello, here I am!'.
When you start this program, the system leaves the current screen (this may be the ABAP Editor Initial Screen) and branches to the output screen:
The name of the output screen is identical to the title of the program specified in the program attributes (see Maintaining Program Attributes ).
The first line on the screen contains the list header. By default, the list header is identical to the title of the program. However, you can maintain the list header alone outside the actual program without affecting the program title. For more information on this topic, see Maintaining Text Elements . The current page number (1) appears on the right.
A horizontal line is displayed, then the actual list begins. The output is displayed here.
You can choose Search to search for specific patterns.
On the screen, the output is normally left-justified. If you use several WRITE statements, the output fields are displayed one after the other, each separated by one column (that is, one blank). If there is not enough space for an output field in the current line, a new line is started.
WRITE: 'COMPANY: ', spfli-carrid.
Note the use of the colon and the commas. The example contains two WRITE statements that are combined into a statement chain.
The program fragment in this example outputs two fields, the literal 'COMPANY: ' and the component CARRID of the table work area SPFLI, to the screen:
The format of the data fields on the output screen depends on their data type (see Predefined Elementary Data Types as well as the keyword documentation).
DATA number TYPE p VALUE '-1234567.89' DECIMALS 2.
WRITE: 'Number', number, 'is packed'.
Number 1,234,567.89- is packed
The number field has a total length of 13, that is, 9 digits including the decimal point, the leading minus sign, and two commas as separators. The output length of the number field is 2*8+1=17 because the field length of a type p field is 8. The remaining characters are filled up with spaces. This means that there are five blanks between the literal 'Number' and the number itself.