ARTICLE
SELECT - Assignment Rules
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 ,
INT8 ,
PREC , QUAN ( b , s ), i ,
int8 ,
p , f
FLTP f
DATS d
TIMS t
Note
Fields of the types STRING and RAWSTRING (
LOB s ) from the result set can be assigned
to reference variables for LOB handle s
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, it is padded with blanks or hexadecimal 0 on
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 padded with zeros on the left. If the target field is too short, the
result is truncated to the left.
If the target field has a numeric data
type , the value range of the field
must be large enough for the result field value.
If the result field contains a null value ,
a type-specific initial value is assigned to the target field.
For the assignment of LOB s to reference variables, refer to
Creating LOB Handle s .
Documentation extract taken from SAP system, � Copyright SAP AG. All rights reserved