Show TOC

Using WRITE via a Statement StructureLocate 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 Start of the navigation path Edit Next navigation step Insert Statement... End of the navigation path 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:

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.

  • 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

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

    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:

    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:

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

    WRITE sym_folder AS SYMBOL.

    Example

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

    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:

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

                
    WRITE: sflight-carrid,
                
    sflight-connid,
                
    sflight-fldate,
                
    sflight-price,
                
    sflight-planetype,
                
    sflight-seatsocc.