SAP TYPES LOB HANDLE ABEXA

Get Example source ABAP code based on a different SAP table
  



Deriving LOB Handle Structures
The example demonstrates the derivation of LOB handle structures using the TYPES statement.

ABAP_SOURCE_CODE
ABAP_EXEC

ABAP_DESCRIPTION
The package-visible area of the demo_lob_handles class contains various derivations of LOB handle structures from the DEMO_LOB_TABLE database table. The methods of the class are used for the output of the static type of the derived LOB handle components.
The DEMO_LOB_TABLE database table contains a key field of type INT4, as well as three columns CLOB1, CLOB2, CLOB3 of type STRING and three columns BLOB1, BLOB2 , BLOB3 of type RAWSTRING.
The derivations listed here function as follows:
In the structured type lob_handle_structure_1, clob1 and blob1 become LOB handle components using direct column specification after READER. The component clob1 contains the static type CL_ABAP_DB_C_READER and blob1 contains the static type CL_ABAP_DB_X_READER. All other components are displayed according to the normal rules for their predefined types.
In the structured type lob_handle_structure_2, all components are turned into LOB components by specifying FOR ALL COLUMNS for LOB handle components. The static type of the components of type STRING is IF_ABAP_DB_CLOB_HANDLE and the static type for the components of type RAWSTRING is IF_ABAP_DB_BLOB_HANDLE.
In the structured type lob_handle_structure_3, all components are converted into LOB components for LOB handle components. The static type of the component of type STRING is converted into CL_ABAP_DB_C_WRITER by specifying WRITER FOR ALL CLOB COLUMNS and the static type for the components of type RAWSTRING is converted into CL_ABAP_DB_X_LOCATOR by specifying LOCATOR FOR ALL BLOB COLUMNS.
In the structured type lob_handle_structure_4, all components are converted into LOB components for LOB handle components. The static type of the components clob1 and clob2 is converted into CL_ABAP_DB_C_READER by directly specifying READER. All components of the type RAWSTRING are converted into reference types for IF_ABAP_DB_BLOB_HANDLE by specifying LOB HANDLE FOR ALL BLOB COLUMNS. The other components of the type STRING are converted into reference types for CL_ABAP_DB_C_LOCATOR by specifying LOCATOR FOR ALL OTHER CLOB COLUMNS.
In the structured type lob_handle_structure_5, all LOB components are listed directly and thereby converted into the corresponding LOB handle components with the static types CL_ABAP_DB_C_LOCATOR for clob1, clob2, and clob3 and CL_ABAP_DB_X_READER for blob1, blob2, and blob3. The LOB HANDLE FOR ALL OTHER COLUMNS specification has no direct effect, but instead works on possible enhancements to the database table of further LOBs, which then maintain their appropriate interface reference type.
In the structured type lob_handle_structure_6, all components are converted into LOB components for LOB handle components, whereby here the maximum number of column specifications is demonstrated. The specification of FOR ALL CLOB COLUMNS is only possible since no components of type STRING were recorded by the previous specifications.