Show TOC

Procedure documentationUsing WRITE via a Statement Structure Locate this document in the navigation structure

Procedure

The SAP system provides a useful facility for trying out all options and output formats of the WRITE statement and inserting them into your program. To do this, choose   Edit   Insert Statement...   in the ABAP Editor and then select WRITE in the relevant dialog box:

When you have confirmed your selection with Enter, you see the following screen:

This graphic is explained in the accompanying text.

On this screen, you can

  • determine the output format of an internal field by entering its name or a literal in the field Fld.You then choose the formatting options on this screen or on another screen which you can access by selecting More formatting options (More formatting options) .

  • generate the WRITE statements for symbols, icons, lines, and checkboxes simply by selecting the appropriate fields.

  • generate the WRITE statements for components of structures defined in the ABAP Dictionary. This is useful, for example, after executing a SELECT statement (see Reading Data from Database Tables).

    Example Example

    On the screen Assemble a WRITE-Statement, select the radio button Symbol and then Display. The following dialog box appears:

    This graphic is explained in the accompanying text.

    End of the example.

    Here, you can choose a symbol, for example, SYM_FOLDER. The next dialog box displays the relevant WRITE statement and the resulting output on the output screen:

    This graphic is explained in the accompanying text.

    In addition, a note is displayed informing you that you need an include program in your program (see Displaying Symbols and Icons on the Screen).

    After choosing Continue, you see that the Symbol field on the Assemble a WRITE Statement screen now contains a value:

    This graphic is explained in the accompanying text.

    If you now choose Execute, the following text is inserted into your program:

    WRITE sym_folder AS SYMBOL.

    Example Example

    On the Assemble a WRITE Statement screen, select the radio button Structure and enter the following in the appropriate input field:

    This graphic is explained in the accompanying text.

    End of the example.

    Then, choose Select components. On the next screen, you can select the components of the ABAP Dictionary structure SFLIGHT you want to output with WRITE, for example:

    This graphic is explained in the accompanying text.

    If you adopt this selection, the following WRITE statement is inserted into your program:

    Syntax Syntax

    1. WRITE: sflight-carrid, 
    2.         sflight-connid,
    3.         sflight-fldate,
    4.         sflight-price,
    5.         sflight-planetype,
    6.         sflight-seatsocc.
    End of the source code.