SAP SELECT INTO CONVERSION Get Example source ABAP code based on a different SAP table
SAP Help
SELECT>, Assignment Rules The following assignment rules apply to assignments of the result fields of the result set of a standalone
SELECT> >, WITH>>, or FETCH>> statement to the target fields defined in the INTO>> clause. ITOC 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>c>, string> ACCP>, NUMC>c>, n> LCHR>c> RAW>, RAWSTRING>, GEOM_EWKB>x>, xstring> LRAW>x> DF16_DEC>decfloat16>, decfloat34> DECFLOAT16>, DF16_RAW>, DF16_SCL> (obsolete) decfloat16> DECFLOAT34>, DF34_DEC>, DF34_RAW>, DF34_SCL> (obsolete)decfloat34> CURR>, DEC>, INT1>, INT2>, INT4>, INT8 >, PREC>, QUAN>(b>, s>,) i> , int8>, p>, f> FLTP>f> DATN>, DATS>d> TIMN>, TIMS>t> UTCLONG>utclong> Latest notes: 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 system classes or one of the system interfaces that support streaming and locators> for AB_SQL . Fields cannot be assigned to enumerated variables>, even if their base type> would be an allowed ABAP type. NON_V5_HINTS ABAP_HINT_END Rules The assignments are made according to the following rules: If the target field is of data type c> or x>, the content of the result field is inserted left-aligned into the target field. 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 left-aligned into the target field. In result fields of the type STRING>, the trailing blanks are transferred. 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 right-aligned into the target field. 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 of the result field is converted to this data type and the value range> of the target field must be large enough. Here, any surplus decimal places in result fields of the type CURR>, DEC>, or QUAN> (numbers in the BCD> format) are cut off. If the result field contains a null value> , a type-dependent initial value is assigned to the target field. BEGIN_SECTION VERSION 5 OUT For assignments of LOBs to reference variables, see LOB Handles>. END_SECTION VERSION 5 OUT ABAP_EXAMPLE_VX5 The variable result1> is given the value 1. Any surplus decimal places are cut off. The built-in SQL function ROUND>> can be used to perform roundings like in conversions> in ABAP. result2> is given the value 2. ABEXA 01256 ABAP_EXAMPLE_END