

No handling of the exception CX_SY_OPEN_SQL_DBĭUPLICATE KEYS is not specified and if the exception is not handled, a runtime error occurs when a duplicate row is inserted.The system fields sy-subrc and sy-dbcnt retain their previous value. Rows continue to be inserted until the exception is raised and handled. Handling of the exception CX_SY_OPEN_SQL_DBĭUPLICATE KEYS is not specified, the handleable exception CX_SY_OPEN_SQL_DB is raised when aĭuplicate row is inserted.The system field sy-dbcnt is set to the number of rows that are inserted. Would produce duplicate entries with respect to the primary key or to a unique secondary index are discardedĪnd sy-subrc set to 4. In this situation, there are the following options:ĭUPLICATE KEYS is specified, all rows are inserted for which this is possible. One or more of the rows to be inserted, these rows cannot be inserted. If a row with the same primary key or the same unique secondary index exists in the database table for Key or with the same unique secondary index exists in the database table for any of the rows toīe inserted, all rows are inserted and sy-subrc is set to 0. The content of each row of the internal table is composed using the same rules as for a single work area wa with the exception that when inserting from an internal table The row type of the internal table must meet the Host expression after FROM and TABLE, from whose content multiple rows are created for insertion in the database table. Īn internal table itab can be specified as a INSERT INTO scarr VALUES a new airline into the database table SCARR with the value operator VALUE in a Inserts a new airline into the database table SCARR using a work area wa. The runtime environment then adds the addition FROM dbtab to the statement INSERT implicitly.

The prerequisite is that aĭbtab for the respective database table or the view is declared using the statement TABLES. This means that the specification of the work area using FROM wa in the variant without INTO can be omitted. Short form of the specification outside of classes If the database table or the view is specified statically, an obsolete Wa, for which the data type is inferred using the # character, a structure consisting of all the database table columns is created as the type. If a constructor expression is specified as a For the derivation ofĪdditions of the statements TYPES and DATA. The work area wa should always be declared in relation to the database table or the view in ABAP Dictionary. Automatic client handling can be switched off using the addition CLIENT SPECIFIED. Specified in wa is ignored and the current client is used instead. The latter applies only if, for the columns of the database table in question, the attribute NOT NULL is not selected in the database.īy default, an automatic client handling is performed, which means that any If a view is specified in target that does not include all columns in the database table, these are set to the type-dependent If it does, the row is not inserted and sy-subrc is set to 4. Primary key or the same unique secondary index. The new row is inserted in the database table if this does not already contain a row with the same In this case of a type for a locator: this must exist and is used as a source. Of a reader stream type, this type is created. The components of the work area that are notĪre assigned directly to the corresponding columns of the new row. Prerequisites) exactly like the structure of the database table. When a LOB handle structure is specified, it must be constructed (in accordance with the Of the row to be added is taken from the work area wa while ignoring its data type and without converting it from left to right in accordance with the structure of the database table or the When specifying a work area that does not contain any reference variables for Prerequisites for use in Open SQL statements. Host expression), from whose content a row is created for insertion in the database table. Strict modes of the syntax check from Release 7.40, SP05.Īfter VALUES and FROM, a non-table-like work area wa can be specified (as a The escape character must be specified in the Host variables without the escape character are The escape character should precede the work area name or the internal table name (as should be the case with every To be inserted are taken from these data objects. After FROM TABLE, an internal table itab can also be specified. Ī non-table-like data object wa can be specified as a data source after theĪdditions VALUES and FROM of the statement INSERT.

SAP NetWeaver AS ABAP Release 752, ©Copyright 2017 SAP AG.
