These statements define an area in an ABAP program in which one or more
Native SQL statements can
be specified. The area between
is not checked completely by the syntax check. The statements entered there are passed to the Native SQL interface and processed there as follows:
Almost all SQL statements that are valid for the addressed database system can be included between
ENDEXEC, in particular the DDL statements. These SQL statements are passed from the Native SQL interface to the database system largely unchanged. The syntax rules are specified by the database system, in particular the case sensitivity rules for database objects. If the syntax allows a separator character between individual statements, you can include multiple Native-SQL statements between
ENDEXEC. Generally, the semicolon (
;) is used as the separator character.
You can also include SAP-specific Native-SQL language elements between
ENDEXEC. These statements are not passed directly from the Native SQL interface to the database, but are converted appropriately. These SAP-specific language elements are:
All Native SQL statements bypass SAP buffering. Automatic client handling is not performed.
ENDEXEC sets the system fields
sy-dbcnt. When using the obsolete addition
PERFORMING, note that implicit cursor processing is carried out and the system fields are set for every read.
|0||The statements between
|4||The statements between
ENDEXEC statement sets
sy-dbcnt to the number
of table rows processed in the last Native SQL statement. After implicit cursor processing with
sy-dbcnt contains the total number of rows read. If an
overflow occurs because the number or rows is greater than 2,147,483,647,
sy-dbcnt is set to -1.
- Programs with Native SQL statements are generally dependent on the database system used, so that they cannot be executed in all AS ABAP systems. This is especially true for the examples in this section, which were written for Informix database systems, unless otherwise stated.
If insertions or modifications with Native SQL statements
INSERTor UPDATE would cause double rows with regard to the primary table key, no exception is raised. Instead,
sy-subrcis set to 4. However, if another operation, such as executing a Stored Procedure, would cause a double row, an exception would be raised.
- The client ID of a database table must be specified explicitly. Remember that application programs should only use the data in the current client. In megatenancy systems, this is checked by the ABAP runtime environment.
The obsolete addition
PERFORMING(not allowed in classes) executes implicit cursor processing and must no longer be used. The obsolete statement
EXIT FROM SQLcan be used to exit this type of processing.
See the executable example for Native SQL.
Cause: Error when building up a secondary database connection.
Cause: The specified secondary database connection is not registered in table DBCON.
Cause: Environment variables with errors in table DBCON used for connection
to SAP or another external database (Multi-Connect). To build up a connection, the environment variables
are read from the table DBCON and analysed. The check resulted that the values are longer than allowed, or that environment variables are missing when building up a connection.
Cause: Illegal disruption of a database selection. The cursor was closed.
Cause: There is already a dataset with the specified key.
Cause: The specified key was not found in the database.
Native SQLdatabase connection.
Cause: No more memory available for a
Cause: The database object already exists in the database. You tried to create a database object (table, View, Index, ...) in the database. This object already existed.
Cause: You used the name of a table or a view that does not exist in the database.
Cause: SQL Error at the execution of a Native SQLcommand.
Cause: The maximum number of secondary database connections was exceeded.
Cause: The maximum number of cursors was exceeded.
Cause: The specified cursor does not exist. At a
SELECTcommand in Native SQL, a cursor was specified which is unknown to the cursor administration.
Cause: The specified cursor is already open. A cursor was specified at a
OPENcommand in Native SQL which the cursor administration knows as already opened.
Cause: No more roll memory available. When processing a Native SQL Statement, the internal memory is required to prepare the SQL Call.
Cause: An indicator variable has the wrong type. It must have the type INT2.
Cause: The connection name has already been assigned. At an
CONNECTcommand in Native SQL, a connection name was specified which is already used for another connection.
Cause: At a
DISCONNECTcommand in Native SQL, the connection "DEFAULT" was specified. This connection cannot be terminated with
Cause: A Native SQL command contains too many variables. As variables are
ABAPfields that are marked with a preceding colon(":") . If the
INTOclause has the form
INTO :wafor a work area
wa, then all the fields of
waare also considered variables.
Cause: At a
DISCONNECTcommand in Native SQL, a connection was specified that is unknown to the connection administration.
Cause: Despite the assurance
INTO STRUCTURE, the target option, specified in the
INTO-clause, is not structured.
Cause: A LOB Variable has the wrong type. LOB Variables must have the type