Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  User Dialogs →  Classic Lists 

Lists # Overview

Other versions: 7.31 | 7.40 | 7.54

Lists as Screens

By default, classic list (or lists for short) are screens, which do not contain screen elements in their display area, but text output defined with ABAP statements instead. Lists are displayed as part of a special list screen, which is a component of the list processor system program.

Lists in ABAP Programs

An ABAP program can process multiple lists, which are stored in one or more list buffers. Each time a screen sequence is called, a new list buffer is opened and assigned to this screen sequence. A single list buffer can contain up to 21 lists: one basic list and 20 details lists. A list index is assigned to each list, and this index organizes the lists in the list buffer in hierarchical list levels. The first list of a list buffer is the basic list with list index 0. All other lists, whose list indexes are increased continuously starting at 1, are details lists.

The output statements of an ABAP program write to the current list, whose list index is determined by the sy-lsind system field. The current list after the call of a screen sequence is the basic list. As long as the basic list is not displayed, no other list levels can be created.

Basic List

The basic list is displayed either implicitly during the processing of an executable program (see SUBMIT) or explicitly using the LEAVE TO LIST-PROCESSING statement. In both cases, the list processor is called, which then sends the list to the list screen. Displaying this list closes it in the list buffer. It can no longer be written to, but it can be read or modified.

Detail Lists

Every user action on a displayed list, which triggers a list event for which an event block is defined in the ABAP program, creates a new details list. The list index of this details list is always one more than the list index of the list on which the event was triggered. This index is contained in the sy-listi system field. The output statements of the event block write to the current details list. If the event block is finished normally, the details list is displayed automatically in the list screen.

User actions on displayed lists can cause a stack of up to 20 details lists to be created in the list buffer. The list with the highest list index (sy-lsind) is always the current list of the ABAP program, while the list with the list index one below the highest (sy-listi) is displayed on the screen. In certain list processing statements, you can use the list index to access all lists within the stack for reading or changing.

The details list stack in a list buffer can be reduced in two ways:

  • A user action on a displayed details list is linked to function code "BACK". This function code causes the previous list to be displayed and reduces the value of sy-lsind by 1. In the basic list, "BACK" causes the current screen sequence to be exited.
  • Within an event block for a list event, a value is assigned to the system field sy-lsind. If the value of sy-lsind after the event block is closed is smaller than the list index of the current list and greater than or equal to 0, then the current list replaces the list of this list level and all lists whose list index is greater than the value of sy-lsind are deleted from the list buffer. Other values of sy-lsind are reset to the index of the current list after the event block is closed.
  • Structure of a List

    A list is made up of list rows with a fixed width of up to 1023 characters. The row width of the current list is stored in the sy-linsz system field. The number of rows of a list is limited only by the storage capacity of the system.

    A list is divided into pages. Every list starts on page 1. The current page of the current list is stored in the sy-pagno system field. The output position on the current page in the list buffer is determined by the list cursor, which is provided in the system fields sy-colno (column) and sy-linno (row). A page can contain a maximum of 60000 rows. The number of rows per page is stored for the current list in the sy-linct system field. The value 0 represents the maximum number of rows per page.

    On every page of a list, you can use rows for a page header and a page footer. The rows of the page header of the basic list are by default filled with a standard page header from the text elements of the ABAP program. The standard page header consists of a standard title and can contain column headings. The standard title is fixed so that it does not disappear when you scroll the page vertically on the screen.

    In the list event TOP-OF-PAGE, you can fill the page header with additional rows. You can fill the page footer only in the list event END-OF-PAGE. The entire page header of the list displayed on top is fixed so that it does not move when you scroll the page vertically. The column headings of the standard page header and the rows filled in TOP-OF-PAGE are moved when you scroll horizontally.

    The lists in the list buffer are screen lists. Their content is displayed in the list screen after an implicit call of the list processor in an executable program or after an explicit call using LEAVE TO LIST-PROCESSING.

    When creating lists, you also have the option of excluding individual pages or all pages of one or more lists from the screen display and to send them to the SAP spool system instead. To do this, you use the addition PRINT ON of the statement NEW-PAGE. All these pages together then form the print list.

    See also Printing Lists.

    Lists and ABAP Objects

    The list processing statements covered in this section are based on global data and events of the runtime environment and are no longer completely supported in ABAP Objects and when using ABAP Objects.

    Classic lists are no longer intended for direct use in production programs. We recommend that you use other suitable output media instead. For table list output, use the classes of SAP List Viewer (ALV), such as CL_SALV_TABLE. For simple text output, use the wrappers of the Browser Control, such as dynamic documents or wrappers of the Textedit Control. An example of the Textedit Control can be found here: Screens, Text Output.

    Lists and Unicode

    When displaying or printing a list, the contents stored in the list buffer are copied onto the list, with the following differences between non-Unicode and Unicode systems:

    • In non-Unicode systems, every character requires as much space in the list buffer as columns on the list. In single-byte systems, a character occupies one byte in the list buffer and one column in the list, while a character that occupies several bytes in the list buffer in multi-byte systems also occupies the same number of columns in the list. For this reason, all the characters stored in the list buffer are displayed in the list in non-Unicode systems.
    • In Unicode systems, every character usually occupies one place in the list buffer. On the list, however, a character can occupy more than one column (especially Eastern Asian characters). However, since the list only contains the same number of columns as there are positions in the list buffer, this means the list can only display fewer characters than are stored in the list buffer. The list output is shortened accordingly (the page is displayed according to the alignment) and is flagged (> or <). On a displayed list, you can choose System → List → Unicode Display to display the entire list content.

    For these reasons, the horizontal position of the list cursor is equal to the output column of a displayed or printed list only in non-Unicode systems. In Unicode systems, this is only guaranteed for the top and bottom output limits.