Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Reads →  SELECT clauses →  SELECT - UP TO, OFFSET 

SELECT, Restriction of the Rows in the Results Set

This example demonstrates the additions UP TO and OFFSET of the statement SELECT.

Other versions: 7.31 | 7.40 | 7.54

Source Code

    setup( ).

    SELECT FROM demo_expressions
           FIELDS id, num1 AS number, numlong1 AS result
           ORDER BY id, num1
           INTO TABLE @DATA(itab)
           OFFSET @o
           UP TO @n ROWS.

    cl_demo_output=>display( itab ).

    DELETE FROM demo_expressions.

Description

An offset and a maximum number of rows can be entered for the results set of a SELECT statement.