SAP ABAP SQL STREAMING



Get Example source ABAP code based on a different SAP table
  


• CL_ABAP_DB_C_READER ABAP_CLASS
• CL_ABAP_DB_X_READER ABAP_CLASS
• CL_ABAP_DB_C_WRITER ABAP_CLASS
• CL_ABAP_DB_X_WRITER ABAP_CLASS
• IF_ABAP_DB_READER ABAP_INTERFACE
• IF_ABAP_DB_WRITER ABAP_INTERFACE

AB_SQL - Streaming
AB_SQL supports streaming for LOBs in data sources.
ITOC

System Classes and System Interfaces for Reader and Writer Streams
The system classes for the various types of data streams are:
CL_ABAP_DB_C_READER for character-like reader streams. The streaming data source is a CLOB.
CL_ABAP_DB_X_READER for binary reader streams. The streaming data source a BLOB.
CL_ABAP_DB_C_WRITER for character-like writer streams. The streaming data sink is a CLOB.
CL_ABAP_DB_X_WRITER for binary writer streams. The streaming data sink a BLOB.
The special interfaces
IF_ABAP_DB_READER
IF_ABAP_DB_WRITER
are used to access the reader and writer streams independently of the stream type. For further resource-independent classes and interfaces, as well as for the hierarchy of the object types, see the figure and explanation under Streaming.

Important Methods
The methods for streaming in AB_SQL are the same as for general streaming.

Data Sources and Data Sinks
Any LOBs declared in DDIC database tables can be considered as data sources or data sinks. The instances of the classes above are data streams bound to LOBs. These are LOB handles and implement the corresponding interfaces. Their use in AB_SQL involves reference variables that point to the relevant LOB handles.

Creating Data Streams for LOBs

Reader Streams
A reader stream that is bound to an LOB, that is, an instance of the class CL_ABAP_DB_C_READER or CL_ABAP_DB_X_READER, can only be created by assigning a LOB from the result set to a reference variable for a reader stream in the INTO clause of the statement SELECT.
See SELECT - LOB Handles.

Writer Streams
A writer stream that is bound to an LOB, that is, an instance of the class CL_ABAP_DB_C_WRITER or CL_ABAP_DB_X_WRITER, can only be created by specifying a reference variable for a reader stream as a source in the statements INSERT, UPDATE, or MODIFY . It is not possible to specify more general reference variables.
See INSERT, UPDATE, MODIFY dbtab - LOB Handles.

Closing Data Streams for LOBs
Since the number of simultaneously opened data streams is limited to 16, they should be closed as soon as possible using the CLOSE method. Regardless of this, reader streams are closed implicitly at the end of a SELECT loop and at the end of a database LUW. An open writer stream is closed implicitly only by using a database rollback. In database commits, on the other hand, an open writer stream produces the runtime error COMMIT_STREAM_ERROR .

Examples

ABAP_EXAMPLES_ABEXA
Reader Stream, Read Database Table
Writer Stream, Fill Database Table
ABAP_EXAMPLE_END