Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Declarations →  Declaration Statements →  Data Types and Data Objects →  Declaring Data Types →  TYPES 


Quick Reference

Other versions: 7.31 | 7.40 | 7.54


TYPES dtype TYPE dbtab|view 
                 lob_handle_type FOR lob_handle_columns
                [ lob_handle_type FOR lob_handle_columns
                 ...                                   ].


Derives a LOB handle structure as a work area for working with streaming and locators in ABAP SQL. dbtab expects a database table defined in ABAP Dictionary or a database view defined for view in ABAP Dictionary.

The columns lob_handle_columns, when specified, are used to determine LOBs from dbtab. The statement creates a deep structure that is constructed for all columns not among the specified columns exactly as it is for a regular TYPE reference to dbtab. For the LOBs included in the specified columns, a component with the same name is created as a LOB handle component. The static type of the LOB handle components is a class or an interface determined by the specified type lob_handle_type, and is assigned to the respective specified column.

The combinations of the additions specified under lob_handle_columns and lob_handle_type are determined using the following rules:

  • A LOB handle structure can be derived for either reading or writing ABAP SQL statements only.
  • A structure for writes can only contain the specified types WRITER and LOCATOR.
  • The definition of the LOB handle components must not contain contradictions, which means that columns must not be assigned to unsuitable types or a column cannot be assigned to multiple types.
  • The definition of LOB handle components must not contain redundancies. If specified, the following must create a set of LOB handle components:

    ... lob_handle_type FOR lob_handle_columns ...

    This set of LOB handle components must not overlap with another specified set of LOB handle components.
  • The definition of the LOB handle components must be specified with as few components as possible. If the same set of LOB handle components can be specified once rather than multiple times, the more comprehensive option must be used.

Apart from the rules specified under lob_handle_columns and lob_handle_type, there are also the following general restrictions:

  • At least one column must be specified.
  • The types specified for the first three specified columns for LOB handle components for reads and the first two columns for LOB handle components for writes cannot be the same.
  • In each case, there can only be one column specified as ALL ... COLUMNS in which BLOB or CLOB is specified.
  • If specified, the columns ALL BLOB|CLOB COLUMNS cover all BLOBs or CLOBs. When specified, a single BLOB or CLOB cannot be specified in specified columns COLUMNS ... for the same static type.
  • The specified columns ALL OTHER COLUMNS include all columns that are not specified individually. ALL OTHER BLOB COLUMNS or ALL OTHER CLOB COLUMNS cannot be specified at the same time.
  • The specified columns ALL COLUMNS include all LOBs and can therefore only be specified on their own.


  • LOB handle structures can also be defined using the corresponding typing of components between BEGIN OF and END OF.
  • LOB handle structures can also be derived in ABAP Dictionary. The display of database tables or views containing LOBs includes a function for this.
  • If dbtab does not contain any LOBs that match the specified columns, no LOB handle components are created and the statement creates a normal work area.
  • If LOBs are added to dbtab that match the specified columns ALL [OTHER] ..., LOB handle components are also created for these.


Declares types for work areas with LOB handle components for a writer stream and a reader stream for the column PICTURE and a locator for all LOBs in the database table DEMO_BLOB_TABLE.

  wa1 TYPE demo_blob_table WRITER FOR COLUMNS picture, 
  wa2 TYPE demo_blob_table READER FOR COLUMNS picture, 
  wa3 TYPE demo_blob_table LOCATOR FOR ALL COLUMNS.

Executable Example

Deriving LOB Handle Structures


TYPES - lob_handle_type

TYPES - lob_handle_columns

Deriving LOB Handle Structures