SAP INSERT UPDATE MODIFY LOB SAP Info










INCLUDE

Restrictions
The following restrictions apply:
  A maximum of 16 data streams can be opened for an Open SQL statement.
  In a database LUW there can be a maximum of 16 Open SQL statements whose streams are open at the same time.
  A maximum of 1000 LOB handles can be open in a database LUW.
INCLUDE

Restrictions
The following restrictions apply:
  A maximum of 16 data streams can be opened for an Open SQL statement.
  In a database LUW there can be a maximum of 16 Open SQL statements whose streams are open at the same time.
  A maximum of 1000 LOB handles can be open in a database LUW.
INCLUDE

Restrictions
The following restrictions apply:
  A maximum of 16 data streams can be opened for an Open SQL statement.
  In a database LUW there can be a maximum of 16 Open SQL statements whose streams are open at the same time.
  A maximum of 1000 LOB handles can be open in a database LUW.
INCLUDE

Restrictions
The following restrictions apply:
  A maximum of 16 data streams can be opened for an Open SQL statement.
  In a database LUW there can be a maximum of 16 Open SQL statements whose streams are open at the same time.
  A maximum of 1000 LOB handles can be open in a database LUW.


ARTICLE ( Version: 0053)

INSERT, UPDATE, MODIFY dbtab - LOB handles
In the INSERT,
UPDATE or MODIFY statements, LOB handles can be created as write streams and specified as locators.

Prerequisites
An LOB in a row to be inserted changed can
be supplied from an LOB handle component of a work area or an individual reference variable for an LOB handle (at UPDATE with SET). The static type of each LOB handle component must be one of the following system classes for streaming or locators:
  CL_ABAP_DB_C_WRITER or CL_ABAP_DB_C_LOCATOR in the case of CLOBs.
  CL_ABAP_DB_X_WRITER or CL_ABAP_DB_X_LOCATOR in the case of BLOBs.
The stream type or
locator type must match the data type of the LOBs.

Rules
Unlike for read accesses , behavior
is not the same for streams and locators.

Changing Accesses Using Write Streams
If, for a changing access, an LOB is
linked to a reference variable of the type CL_ABAP_DB_C_WRITER or CL_ABAP_DB_X_WRITER, a corresponding write stream is usually created and the reference variable points to the object after execution. The LOB to be changed can be edited using the methods of the write stream. When connecting an LOB to a write stream which is referenced by an LOB handle component from the source work area, the following various platform-dependant behaviors may occur:
  On some database systems (MaxDB, Oracle), the components of the work area which are not LOB handle components are written directly to the database when executing the statement. If the rows cannot be added or changed, sy-subrc and sy-dbcnt respectively are set immediately and no write stream is created for the LOB handle components. If the rows can be added or changed, write streams are created and their content is transferred to the database at the latest when closing the last write stream of the Open SQL statement at the latest.
  On other database systems, the components of the work area which are not LOB handle components are not written directly to the database when executing the statement. Instead, write streams are always created for the LOB handle components. The contents of the remaining components are also delayed, that is, they are transferred when closing the last write stream of the Open SQL statement at the latest. Between executing the statement and actually writing the remaining components, the status is undefined since it is not yet determined whether the operation can be executed at all. In this case, sy-subrc statement is set to the value 2 and sy-dbcnt is set to -1 after the execution of the statement. Before closing a write stream, you can get a reference to an object from the CL_ABAP_SQL_CHANGING_STMNT class, a subclass of CL_ABAP_SQL_STATEMENT_HANDLE , from the IF_ABAP_DB_WRITER interface using the method GET_STATEMENT_HANDLE. The GET_STATE method provides information about the status of the Open SQL statement, and the GET_DB_COUNT method returns the number of added or changed rows after the last write stream of the Open SQL statement was closed. The methods of the abstract superclass can be used to check the status of the Open SQL statement and all streams that are still open can be closed. Until the Open SQL statement has been closed by closing the last write stream, GET_DB_COUNT returns the value -1. If the operation cannot be executed, for example because of duplicate key entries, it leads to one of the exceptions CX_STREAM_IO_EXCEPTION or CX_CLOSE_RESOURCE_ERROR when transferring to the database, depending on when the data transfer takes place.
A write stream created in this way exists until it is explicitly closed
using ist method CLOSE from the IF_ABAP_CLOSE_RESOURCE interface. As long as a write stream for an Open SQL statement is still open, the corresponding database operation is not finished. The status of the Open SQL statement is described using an object of the CL_ABAP_SQL_STATEMENT_HANDLE class, for which the GET_STATEMENT_HANDLE method returns a reference for every write stream.
When using write streams, an undetectable runtime error occurs in the
following cases:
  If a write stream is still open when closing a database LUW using a database commit.
  When accessing a write stream that is already closed.

Notes
  Exactly when the data of a write stream is transferred to the database is not yet determined. The transfer takes place at the latest when closing the last write stream but can also occur during writing in the stream, for example because a buffer is not adequate anymore.
  Always close a write stream explicitly and as soon as possible using its method CLOSE. Also refer to Streaming and Locators.

Changing Accesses Using Locators.
If, for a changing access, an LOB is
linked to a reference variable of type CL_ABAP_DB_C_LOCATOR or CL_ABAP_DB_X_LOCATOR, this must point to a corresponding locator, which was created in the SELECT

or FETCH ( Version: 0053)statement for an LOB of a different or the same database table . If the statement can be executed ( sy-subrc is 0), the LOB to be changed is replaced directly in the database system using the complete LOB of the locator .

INTHINT After Release 7.02 Locators can also be created by FETCH ( Version: 0053)
ABENLOB_HANDLE_RESTRICTIONS OBJECT DOKU ID SD

Note
Always close a LOB handle as soon as possible using its method
CLOSE. Also refer to Streaming and Locators.

Examples
  Write stream, fill database
  Locator, copy column

ARTICLE ( Version: 0054)

INSERT, UPDATE, MODIFY dbtab - LOB Handles
In the INSERT,
UPDATE, or MODIFY statements, LOB handles can be created as write streams and specified as locators.

Prerequisites
An LOB in a row to be inserted or changed
can be supplied from an LOB handle component of a work area or an individual reference variable for an LOB handle (at UPDATE with SET). The static type of each LOB handle component must be one of the following system classes for streaming or locators:
  CL_ABAP_DB_C_WRITER or CL_ABAP_DB_C_LOCATOR in the case of CLOBs.
  CL_ABAP_DB_X_WRITER or CL_ABAP_DB_X_LOCATOR in the case of BLOBs.
The stream type or
locator type must match the data type of the LOBs.

Rules
Unlike for read accesses , the
behavior is not the same for streams and locators.

Changing Accesses Using Write Streams
If, for a changing access, an LOB is
linked to a reference variable of the type CL_ABAP_DB_C_WRITER or CL_ABAP_DB_X_WRITER, a corresponding write stream is usually created and the reference variable points to the object after execution. The LOB to be changed can be edited using the methods of the write stream. When connecting an LOB to a write stream which is referenced by an LOB handle component from the source work area, the following various platform-dependent behavior may occur:
  On some database systems (MaxDB, Oracle), the components of the work area which are not LOB handle components are written directly to the database when executing the statement. If the rows cannot be added or changed, sy-subrc and sy-dbcnt respectively are set immediately and no write stream is created for the LOB handle components. If the rows can be added or changed, write streams are created and their content is passed to the database when closing the last write stream of the Open SQL statement at the latest.
  On other database systems, the components of the work area which are not LOB handle components are not written directly to the database when executing the statement. Instead, write streams are always created for the LOB handle components. The contents of the remaining components are also delayed, that is, they are passed when closing the last write stream of the Open SQL statement at the latest. Between executing the statement and actually writing the remaining components, the status is undefined since it is not yet determined whether the operation can be executed at all. In this case, sy-subrc statement is set to the value 2 and sy-dbcnt is set to -1 after the execution of the statement. Before closing a write stream, you can get a reference to an object from the CL_ABAP_SQL_CHANGING_STMNT class, a subclass of CL_ABAP_SQL_STATEMENT_HANDLE, from the IF_ABAP_DB_WRITER interface using the method GET_STATEMENT_HANDLE. The GET_STATE method provides information about the status of the Open SQL statement, and the GET_DB_COUNT method returns the number of added or changed rows after the last write stream of the Open SQL statement was closed. The methods of the abstract superclass can be used to check the status of the Open SQL statement and all streams that are still open can be closed. if the Open SQL statement is not closed by the closing of the last write stream, GET_DB_COUNT also returns the value -1. If the operation cannot be executed, for example due to duplicate key entries, the exception CX_STREAM_IO_EXCEPTION or CX_CLOSE_RESOURCE_ERROR is raised when the data is passed to the database, depending on exactly when the data is passed.
A write stream created in this way exists until it is explicitly closed
using its method CLOSE from the IF_ABAP_CLOSE_RESOURCE interface. As long as a write stream for an Open SQL statement is still open, the corresponding database operation is not finished. The state of the Open SQL statement is described using an object of the CL_ABAP_SQL_STATEMENT_HANDLE class, for which the GET_STATEMENT_HANDLE method returns a reference for every write stream.
When using write streams, a non-catchable runtime error occurs in the
following cases:
  If a write stream is still open when closing a database LUW using a database commit.
  When accessing a write stream that is already closed.

Notes
  Exactly when the data of a write stream is passed to the database is not defined. The data is passed at the latest when the last write stream is closed but can also occur during writing in the stream, for example because a buffer is no longer large enough.
  Always close a write stream explicitly and as soon as possible using its method CLOSE. Also refer to Streaming and Locators.

Changing Accesses Using Locators.
If, in a change access, an LOB is
associated with a reference variable of type CL_ABAP_DB_C_LOCATOR or CL_ABAP_DB_X_LOCATOR, then this variable must point to an appropriate locator, created in a statement SELECT

oder FETCH ( Version: 0054)for a LOB in a different database table or the same table. If the statement can be executed (sy-subrc is 0), the LOB to be changed is replaced directly in the database system using the complete LOB of the locator.

INTHINT After Release 7.02 Locators can be created also by FETCH ( Version: 0054)
ABENLOB_HANDLE_RESTRICTIONS OBJECT DOKU ID SD

Note
Always close a LOB handle as soon as possible using its method
CLOSE. Also refer to Streaming and Locators.

Examples
  Write stream, fill database
  Locator, copy column

ARTICLE ( Version: 0056)

INSERT, UPDATE, MODIFY dbtab - LOB Handles
In the INSERT,
UPDATE, or MODIFY statements, LOB handles can be created as write streams and specified as locators.

Prerequisites
An LOB in a row to be inserted or changed
can be supplied from an LOB handle component of a work area or an individual reference variable for an LOB handle (at UPDATE with SET). The static type of each LOB handle component must be one of the following system classes for streaming or locators:
  CL_ABAP_DB_C_WRITER or CL_ABAP_DB_C_LOCATOR in the case of CLOBs.
  CL_ABAP_DB_X_WRITER or CL_ABAP_DB_X_LOCATOR in the case of BLOBs.
The stream type or
locator type must match the data type of the LOBs.

Rules
Unlike for read accesses , the
behavior is not the same for streams and locators.

Changing Accesses Using Write Streams
If, for a changing access, an LOB is
linked to a reference variable of the type CL_ABAP_DB_C_WRITER or CL_ABAP_DB_X_WRITER, a corresponding write stream is usually created and the reference variable points to the object after execution. The LOB to be changed can be edited using the methods of the write stream. When connecting an LOB to a write stream which is referenced by an LOB handle component from the source work area, the following various platform-dependent behavior may occur:
  On some database systems (MaxDB, Oracle), the components of the work area which are not LOB handle components are written directly to the database when executing the statement. If the rows cannot be added or changed, sy-subrc and sy-dbcnt respectively are set immediately and no write stream is created for the LOB handle components. If the rows can be added or changed, write streams are created and their content is passed to the database when closing the last write stream of the Open SQL statement at the latest.
  On other database systems, the components of the work area which are not LOB handle components are not written directly to the database when executing the statement. Instead, write streams are always created for the LOB handle components. The contents of the remaining components are also delayed, that is, they are passed when closing the last write stream of the Open SQL statement at the latest. Between executing the statement and actually writing the remaining components, the status is undefined since it is not yet determined whether the operation can be executed at all. In this case, sy-subrc statement is set to the value 2 and sy-dbcnt is set to -1 after the execution of the statement. Before closing a write stream, you can get a reference to an object from the CL_ABAP_SQL_CHANGING_STMNT class, a subclass of CL_ABAP_SQL_STATEMENT_HANDLE, from the IF_ABAP_DB_WRITER interface using the method GET_STATEMENT_HANDLE. The GET_STATE method provides information about the status of the Open SQL statement, and the GET_DB_COUNT method returns the number of added or changed rows after the last write stream of the Open SQL statement was closed. The methods of the abstract superclass can be used to check the status of the Open SQL statement and all streams that are still open can be closed. if the Open SQL statement is not closed by the closing of the last write stream, GET_DB_COUNT also returns the value -1. If the operation cannot be executed, for example due to duplicate key entries, the exception CX_STREAM_IO_EXCEPTION or CX_CLOSE_RESOURCE_ERROR is raised when the data is passed to the database, depending on exactly when the data is passed.
A write stream created in this way exists until it is explicitly closed
using its method CLOSE from the IF_ABAP_CLOSE_RESOURCE interface. As long as a write stream for an Open SQL statement is still open, the corresponding database operation is not finished. The state of the Open SQL statement is described using an object of the CL_ABAP_SQL_STATEMENT_HANDLE class, for which the GET_STATEMENT_HANDLE method returns a reference for every write stream.
When using write streams, a non-catchable runtime error occurs in the
following cases:
  If a write stream is still open when closing a database LUW using a database commit.
  When accessing a write stream that is already closed.

Notes
  Exactly when the data of a write stream is passed to the database is not defined. The data is passed at the latest when the last write stream is closed but can also occur during writing in the stream, for example because a buffer is no longer large enough.
  Always close a write stream explicitly and as soon as possible using its method CLOSE. Also refer to Streaming and Locators.

Changing Accesses Using Locators.
If, in a change access, an LOB is
associated with a reference variable of type CL_ABAP_DB_C_LOCATOR or CL_ABAP_DB_X_LOCATOR, then this variable must point to an appropriate locator, created in a statement SELECT

oder FETCH ( Version: 0056)for a LOB in a different database table or the same table. If the statement can be executed (sy-subrc is 0), the LOB to be changed is replaced directly in the database system using the complete LOB of the locator.

INTHINT In a upcoming Release Locators should be created also by ( Version: 0056)

INTHINT FETCH ( Version: 0056)
ABENLOB_HANDLE_RESTRICTIONS OBJECT DOKU ID SD

Note
Always close a LOB handle as soon as possible using its method
CLOSE. Also refer to Streaming and Locators.

Examples
  Write stream, fill database
  Locator, copy column

ARTICLE ( Version: 0057)

INSERT, UPDATE, MODIFY dbtab - LOB Handles
In the INSERT,
UPDATE, or MODIFY statements, LOB handles can be created as writer streams and specified as locators.

Prerequisites
An LOB in a row to be inserted or changed
can be supplied from an LOB handle component of a work area or an individual reference variable for an LOB handle (at UPDATE with SET). The static type of each LOB handle component must be one of the following system classes for streaming or locators:
  CL_ABAP_DB_C_WRITER or CL_ABAP_DB_C_LOCATOR in the case of CLOBs.
  CL_ABAP_DB_X_WRITER or CL_ABAP_DB_X_LOCATOR in the case of BLOBs.
The stream type or
locator type must match the data type of the LOBs.

Rules
Unlike for read accesses , the
behavior is not the same for streams and locators.

Changing Accesses Using Writer Streams
If, for a changing access, an LOB is
linked to a reference variable of the type CL_ABAP_DB_C_WRITER or CL_ABAP_DB_X_WRITER, a corresponding writer stream is usually created and the reference variable points to the object after execution. The LOB to be changed can be edited using the methods of the writer stream. When connecting an LOB to a writer stream which is referenced by an LOB handle component from the source work area, the following various platform-dependent behavior may occur:
  On some database systems (MaxDB, Oracle), the components of the work area which are not LOB handle components are written directly to the database when executing the statement. If the rows cannot be added or changed, sy-subrc and sy-dbcnt respectively are set immediately and no writer stream is created for the LOB handle components. If the rows can be added or changed, writer streams are created and their content is passed to the database when closing the last writer stream of the Open SQL statement at the latest.
  On other database systems, the components of the work area which are not LOB handle components are not written directly to the database when executing the statement. Instead, writer streams are always created for the LOB handle components. The contents of the remaining components are also delayed, that is, they are passed when closing the last writer stream of the Open SQL statement at the latest. Between executing the statement and actually writing the remaining components, the status is undefined since it is not yet determined whether the operation can be executed at all. In this case, sy-subrc statement is set to the value 2 and sy-dbcnt is set to -1 after the execution of the statement. Before a writer stream is closed, a reference to an object from the class CL_ABAP_SQL_CHANGING_STMNT, a subclass of CL_ABAP_SQL_STATEMENT_HANDLE, from the interface IF_ABAP_DB_WRITER, can be obtained using the method GET_STATEMENT_HANDLE. The GET_STATE method provides information about the status of the Open SQL statement, and the GET_DB_COUNT method returns the number of added or changed rows after the last writer stream of the Open SQL statement was closed. The methods of the abstract superclass can be used to check the status of the Open SQL statement and all streams that are still open can be closed. if the Open SQL statement is not closed by the closing of the last writer stream, GET_DB_COUNT also returns the value -1. If the operation cannot be executed, for example due to duplicate key entries, the exception CX_STREAM_IO_EXCEPTION or CX_CLOSE_RESOURCE_ERROR is raised when the data is passed to the database, depending on exactly when the data is passed.
A writer stream created in this way exists until it is explicitly closed
using its method CLOSE from the IF_ABAP_CLOSE_RESOURCE interface. As long as a writer stream for an Open SQL statement is still open, the corresponding database operation is not finished. The state of the Open SQL statement is described using an object of the CL_ABAP_SQL_STATEMENT_HANDLE class, for which the GET_STATEMENT_HANDLE method returns a reference for every writer stream.
When using writer streams, an unhandleable exception is raised in the
following cases:
  If a writer stream is still open when closing a database LUW using a database commit.
  When accessing a writer stream that is already closed.

Notes
  Exactly when the data of a writer stream is passed to the database is not defined. The data is passed at the latest when the last writer stream is closed but can also occur during writing in the stream, for example because a buffer is no longer large enough.
  Always close a writer stream explicitly and as soon as possible using its method CLOSE. Also refer to Streaming and Locators.

Changing Accesses Using Locators.
If, in a change access, an LOB is
associated with a reference variable of type CL_ABAP_DB_C_LOCATOR or CL_ABAP_DB_X_LOCATOR, then this variable must point to an appropriate locator, created in a statement SELECT

oder FETCH ( Version: 0057)for a LOB in a different database table or the same table. If the statement can be executed (sy-subrc is 0), the LOB to be changed is replaced directly in the database system using the complete LOB of the locator.

INTHINT In a upcoming Release Locators should be created also by ( Version: 0057)

INTHINT FETCH ( Version: 0057)
ABENLOB_HANDLE_RESTRICTIONS OBJECT DOKU ID SD

Note
Always close a LOB handle as soon as possible using its method
CLOSE. Also refer to Streaming and Locators.

Examples
  Writer stream, fill database
  Locator, copy column
Message text extract from SAP system. Copyright SAP SE.


Search for further information about these or an SAP related objects



Comments on this SAP object

What made you want to lookup this SAP object? Please tell us what you were looking for and anything you would like to be included on this page!