Skip to content

ABAP Keyword Documentation →  ABAP − Reference →  Processing Internal Data →  Streaming →  Streaming for Data Objects 

Streaming for Strings

The specific classes for streaming for strings are:

  • CL_ABAP_STRING_C_READER
  • CL_ABAP_STRING_C_WRITER
  • CL_ABAP_STRING_X_READER
  • CL_ABAP_STRING_X_WRITER

These classes are subclasses of the abstract superclasses CL_ABAP_MEMORY_....

Other versions: 7.31 | 7.40 | 7.54


Example

A writer stream is used to fill a string and then pass it to a reader stream. The reader stream skips three characters and then reads the remaining characters.

DATA(string_writer) = NEW cl_abap_string_c_writer( ). 

DO 10 TIMES. 
  string_writer->write( |{ sy-index - 1 }| ). 
ENDDO. 
string_writer->close( ). 

DATA(string_reader) = 
  NEW cl_abap_string_c_reader( string_writer->get_result_string( ) ). 

string_reader->skip( 3 ). 
WHILE string_reader->data_available( ) = 'X'. 
  cl_demo_output=>write( string_reader->read( 1 ) ). 
ENDWHILE. 
string_reader->close( ). 

cl_demo_output=>display( ).