Entering content frameThe WRITE Statement Locate the document in its SAP Library structure

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 Structure link 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.


PROGRAM sapmztst.

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:

This graphic is explained in the accompanying text

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 Structure link Maintaining Text Elements. The current page number (1) appears on the right.

A horizontal line is displayed, then the actual list begins.

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.


PROGRAM sapmtest.

TABLES spfli.


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.

In the above example, two fields, literal 'COMPANY: ' and component CARRID of table work area SPFLI, are displayed on the screen.


The format of the data fields on the output screen depends on their data type (see Predefined Elementary Data Types).

Output format of predefined data types

Data Type

Output length



field length












field length



2 * field length (+1)






2 * field length


The numeric data types F, I, and P are right-justified and padded with blanks on the left. If there is sufficient space, thousands separators are also displayed. If a type P field contains decimal places, the default output length is increased by one.


With data type D, the internal format of a date differs from its output format. When you use the WRITE statement for displaying data, the system automatically converts dates of type D based on the format specified in the userís master record (for example, DD/MM/YYYY or MM/DD/YYYY).


PROGRAM sapmtest.

DATA number TYPE p VALUE '-1234567.89' DECIMALS 2.

WRITE: 'Number', number, 'is packed'.

The output appears as follows:

Number 1,234,567.89- is packed

The field NUMBER has a total length of 13, made up of 9 digits, decimal point, minus sign, and two thousand 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.



Leaving content frame