Skip to content

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

SELECT - Assignment Rules for Individual Columns

Other versions: 7.31 | 7.40 | 7.54

Prerequisites

The following table shows the prerequisites for assigning individual columns of the result set to individual data objects - that is, for all forms of the SELECT statement, except when all columns in a work area wa are read with * and CORRESPONDING FIELDS is not specified at the same time. The table shows which data types of the result set can be assigned to which ABAP data types.

Data Type of Column in Result Set ABAP Data Type
CHAR, CLNT, CUKY, LANG, SSTRING, STRING, UNIT, VARC c, string
ACCP, NUMC c, n
LCHR c
RAW, RAWSTRING x, xstring
LRAW x
DF16_DEC decfloat16, decfloat34
DF16_RAW, DF16_SCL decfloat16
DF34_DEC, DF34_RAW, DF34_SCL decfloat34
CURR, DEC, INT1, INT2, INT4, PREC, QUAN (b, s),i, p, f
FLTP f
DATS d
TIMS t


Note

Fields of the types STRING and RAWSTRING (LOBs) from the result set can be assigned to reference variables for LOB handles as well as to strings. The static type of these reference variables must be one of the class system classes or one of the intf system interfaces which support streaming and locators for Open SQL.

Rules

The following rules apply to the assignment procedure:

  • If the target field is of data type c or x, the content of the result field is inserted into the target field, left-aligned. If the target field is too short, the result is truncated to the right. If the target field is too long, spaces or hexadecimal 0 are filled to the right.
  • If the target field is of data type string or xstring, the content of the result field is inserted into the target field, left-aligned. In result fields of the type STRING, trailing spaces are adopted. The target field has the same length as the result field.
  • If the target field is of data type n, the content of the result field is inserted into the target field, right-aligned. If necessary, it is filled with zeros to the left. If the target field is too short, the result is truncated to the left.
  • If the result field contains a null value, a type-specific initial value is assigned to the target field.

For the assignment of LOBs to reference variables, refer to Creating LOB Handles.