Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP - Database Accesses →  Open SQL 

Open SQL - Work Areas in Statements

If in the Open SQL statements

  • SELECT or FETCH without the CORRESPONDING FIELDS addition,

work areas wa or internal tables itab are specified as the target or source areas, the following prequisites apply to the work area or row type of the internal table; if the prerequisites are ignored, a syntax error or an exception will occur.

Other versions: 7.31 | 7.40 | 7.54

Work Areas without Reference Variables for LOB Handles

The following rules apply to work areas that do not contain reference variables for LOB Handles. The first two points are minimum prerequisites that were replaced in Unicode programs or in the handling of strings in database tables through stricter requirements:

  • The data type of the work area or row type of the internal table must not be deep or contain deep components. This excludes strings and special work areas for streaming and locators.
  • The work area or row type of the internal table must be at least as long as the database structure and the alignment must match. For the DELETE statement, this prerequisite must only be met in the length of the primary key.
  • If the work area or rows of the internal table are stuctured, the Unicode fragment view of the database structure must match that of the work area or the internal table in Unicode programs.
  • If the work area or rows of the internal table are elementary, they must be character-type and flat in Unicode programs. The columns of the database structure must also be character-type and flat.
  • If the work area contains strings as components or is itself a string, or if columns of type SSTRING, STRING, or RAWSTRING appear in the database structure, the work area must be compatible with the database structure.
  • For the modifying operations INSERT, UPDATE, and MODIFY, the passed values must match the value range of the columns of the database tables. Otherwise, overflows and corresponding exceptions occur. This applies in particular for:
  • Columns with numerical data types.
  • Columns of the types SSTRING, STRING, or RAWSTRING. The strings of the work area must not be longer than the maximum length of the columns in the database structure. This length can be determined using the built-in function dbmaxlen.


The work area or row structure of the internal table should always be built like the database structure. If you work in the Open SQL statement with a single database table or one view, a data object built the same way can be declared with reference to the relevant structure in the ABAP Dictionary. If you work with more than one database table (in the SELECT statement), a data object built the same way can be built as nested structure, which contains, as substructures, the structures of the single database tables or views in the sequence in which they are listed in the statement. No structure should be used in which all components lie on one level, as possible alignment gaps between the single database tables or views are not taken into account.

LOB Handle Structures

If a work area is an LOB handle structure, that is, it contains at least one reference variable for LOB handles, it must be structured exactly like the structure of the database table and all components except for the LOB handle components must be compatible with the corresponding components of the database table. The static type of each LOB handle component must contain the IF_ABAP_DB_LOB_HANDLE interface and match both the current statement and the data type of the assigned LOB.


In the FETCH statement, no LOB handle structures can currently be specified.