SAP SELECT INTO CONVERSION

Get Example source ABAP code based on a different SAP table
  


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 SetABAP Data Type CHAR, CLNT, CUKY, LANG, SSTRING, STRING, UNIT, VARC c, string ACCP, NUMCc, n LCHRc RAW, RAWSTRINGx, xstring LRAWx DF16_DECdecfloat16, decfloat34 DF16_RAW, DF16_SCLdecfloat16 DF34_DEC, DF34_RAW, DF34_SCLdecfloat34 CURR, DEC, INT1, INT2, INT4,
INT8, PREC , QUAN(b, s), i,
int8, p, f FLTPf DATSd TIMSt

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, 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 LOBs to reference variables, refer to Creating LOB Handles.