Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing External Data →  ABAP Database Access →  ABAP SQL →  ABAP SQL - Reads →  SELECT clauses →  SELECT - INTO, APPENDING →  SELECT - LOB Handles 

SELECT - CREATING

Quick Reference

Other versions: 7.31 | 7.40 | 7.54

Syntax


... CREATING {  READER|LOCATOR FOR { COLUMNS blob1 blob2 ... clob1 clob2 ... } 
                                 | { ALL [OTHER] [BLOB|CLOB] COLUMNS }
               [READER|LOCATOR FOR ...] }

           | {  (crea_syntax) }  ...

Extras

1. ... READER|LOCATOR

2. ... [ALL [OTHER] [BLOB|CLOB]] COLUMNS [blob1 blob2 ... clob1 clob2 ...]
3. ... (crea_syntax)

Effect

The addition CREATING must be specified after INTO or APPENDING when a reference variable for a LOB handle is assigned to a LOB of the results set as a target field and the static type of this reference variable is one of the following three LOB interfaces:

  • IF_ABAP_DB_LOB_HANDLE
  • IF_ABAP_DB_BLOB_HANDLE
  • IF_ABAP_DB_BLOB_HANDLE

The information specified after CREATING determines the class from which the associated LOB handles are created. For all other possible static types, the class can be determined from the static type and the LOB type. CREATING cannot be specified in this case.

The CREATING addition can be specified either statically or dynamically. In the static variant, class and columns are determined using additions; in the dynamic variant, the syntax of the static variants is specified in crea_syntax.

The syntax and the rules for the additions after CREATING correspond to the type and columns specified for the derivation of LOB handle structures with TYPES. Unlike the statement TYPES, the type specified is limited here to READER and LOCATOR, and only components that are typed with a LOB interface are respected. The types specified for the first two entries after CREATING cannot be the same.

Addition 1

... READER|LOCATOR

Effect

These additions determine the LOB handle class for each of the columns specified.

  • READER creates reader streams for all of the columns specified.
  • LOCATOR creates locators for all of the columns specified after these.

The assignment to the classes is the same as the type specified in the derivation of a LOB handle structure using TYPES, except that here it is the dynamic type that is determined and not the static type.


Example

After a row is read, the dynamic type of reader is CL_ABAP_DB_X_READER.

DATA reader TYPE REF TO if_abap_db_lob_handle. 

SELECT SINGLE picture 
       FROM demo_blob_table 
       WHERE name = '...' 
       INTO @reader CREATING READER FOR COLUMNS picture. 

Addition 2

... [ALL [OTHER] [BLOB|CLOB]] COLUMNS [blob1 blob2 ... clob1 clob2 ...]

Effect

These additions assign the previous type specifications to the columns of the result set. The meaning of the additions is the same as the columns specified in the derivation of an LOB handle structure using TYPES. The difference is that the set of columns used is made up exactly of those columns from the results set that were assigned to a reference variable whose static type is an LOB interface:

  • Do not specify individual columns for which this is not the case.
  • The specification of ALL ... COLUMNS only takes such columns into account.

The combination options for columns specified with one another and with types specified are the same as for TYPES. Specifically, the column specified as ALL OTHER ... must be the last column specified.


Notes

  • The specification of ALL ... COLUMNS also takes into account columns which are added by later enhancements to the data sources.
  • The actual names must be used for the columns specified as blob1, blob2, clob1, clob2, and so on. The alias names defined using AS are ignored.
  • The columns cannot be specified using path expressions.
  • Columns of the type GEOM_EWKB are not supported as BLOBs.

Example

Like the previous example, but the column PICTURE is selected automatically here.

DATA reader TYPE REF TO if_abap_db_blob_handle. 

SELECT SINGLE picture 
       FROM demo_blob_table 
       WHERE name = '...' 
       INTO @reader CREATING READER FOR ALL BLOB COLUMNS. 

Addition 3

... (crea_syntax)

Effect

As an alternative to static variants, a data object crea_syntax can be specified in parentheses which contains the syntax of the static additions or is initial when executing the statement. For crea_syntax, the same applies as for column_syntax when specifying columns dynamically in the SELECT list. If the content of crea_syntax is initial, the addition CREATING is ignored.


Example

Like the previous example, but the items that follow CREATING are specified dynamically here.

DATA reader TYPE REF TO if_abap_db_blob_handle. 

DATA(crea_syntax) = `READER FOR ALL BLOB COLUMNS`. 

SELECT SINGLE picture 
       FROM demo_blob_table 
       WHERE name = '...' 
       INTO @reader CREATING (crea_syntax).