Skip to content

ABAP Keyword Documentation →  ABAP - Reference →  Processing External Data →  ABAP Database Accesses →  Open SQL →  Open SQL - Writes 


Other versions: 7.31 | 7.40 | 7.54


... CONNECTION con|(con_syntax)


The Open SQL command is not executed on the standard database connection but on the specified secondary database connection. The database connection can be specified statically with con or dynamically as the content of con_syntax, where the field con_syntax must belong to the type c or string. The database connection must be specified with a name, which is contained in the table DBCON in the column CON_NAME or which begins with prefix R/3* and therefore represents a service connection for the standard database.

The database tables or views specified in the current Open SQL statement must be active in ABAP Dictionary in the current AS ABAP regardless of the specified database connection. Only transparent tables can be specified as database tables. Pooled tables and cluster tables cannot be specified together with the addition CONNECTION. In the secondary database, an identically named and usable object with a suitable structure must exist for each database table or view specified in the current Open SQL statement. If not, an exception is raised.


  • Secondary database connections can be used to access all views that can be accessed using Open SQL, namely database views, projection views, external views, and CDS views. CDS views can be specified using the name of the CDS entity and the CDS database view.
  • The type of a database object specified in an Open SQL statement does not necessarily need to match the type of the database object with the same name in the secondary database. For example, a view with the same name in the secondary database can be accessed by specifying a database table (or a database table by specifying a view) if they have the same structure.
  • Entries in the database table DBCON can only be created and modified using the DBA Cockpit tool.
  • The addition CONNECTION must be specified immediately after the name of the database table or after the addition CLIENT SPECIFIED.