ABAP Keyword Documentation → ABAP - Reference → Declarative statemnts → Data Types and Data Objects → Declaring Data Types → TYPES
TYPES - LOB HANDLE
Other versions: 7.31 | 7.40 | 7.54
Syntax
TYPES dtype TYPE dbtab lob_handle_type FOR lob_handle_columns
[lob_handle_type FOR lob_handle_columns
...
].
Effect
Derivation of an LOB handle structure as work area for working with
streaming and locators in Open SQL. For dbtab
, you must specify a
database table which is defined in the ABAP dictionary, or a
view that is defined in the ABAP Dictionary.
The column specifications lob_handle_columns
are used to determine
LOBs from dbtab
.
The statement creates a deep structure which is constructed exactly the same for all columns which are
not included in the column specification as it is for a normal
TYPE reference to dbtab
. For the LOBs included in the column specifications, 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 which is determined by the type specification
lob_handle_type
, and is assigned to the respective column specification.
The combination possibilities of the additions specified at
lob_handle_columns
and lob_handle_type
, is determined using the following rules:
-
An LOB handle structure can be derived for either read-only, or for write-only Open SQL statements.
- A structure for read accesses can only contain the type specifications
READER
,LOCATOR
, andLOB HANDLE
.
- The definition of the LOB handle components must not contain contradictions, 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. Each specification of
... lob_handle_type FOR lob_handle_columns ...
must create a set of LOB handle components which do not overlap with the LOB handle component set of another specification. -
The definition of LOB handle components must have a minimum number of specifications. If a specification
can create the same set of LOB handle components as multiple specifications, the more extensive specification must be used.
Apart from the rules listed under lob_handle_columns
and lob_handle_type
, there are also the following general restrictions:
- At least one column specification must be made.
- The type specification for the first three column specifications for LOB handle component read accesses and the first two columns for LOB handle component write accesses can not be the same.
-
In each case there can only be one column specification
ALL ... COLUMNS
, in whichBLOB
orCLOB
are specified. -
The column specifications ALL
BLOB|CLOB COLUMNS include all BLOBs or CLOBs. When they are specified, you cannot also specify an individual BLOB or CLOB in a
column specification
COLUMNS ...
for the same static type. -
The column specification ALL
OTHER COLUMNS includes all columns that are not specified individually.
ALL OTHER BLOB COLUMNS
andALL OTHER CLOB COLUMNS
cannot be specified at the same time. -
The
ALL COLUMNS
column specification includes all LOBs and can therefore only be specified on its own.
Notes
-
LOB handle structures can also be defined using the corresponding specification of components between
BEGIN OF
andEND OF
. - LOB handle structures can also be derived in the ABAP Dictionary. A function is provided for this purpose when database tables or views that contain LOBs are displayed.
-
If
dbtab
does not contain any LOBs that match the column specifications, no LOB handle components are created and the statement creates a normal work area. -
If
dbtab
is enhanced later by LOBs which match the column specificationsALL [OTHER] ...
, then LOB handle components are also created for these.
Example
Refer to Deriving LOB handle structures.