|Category||ABAP Programming Error|
Application Component Not assigned
Error Analysis :
An exception has occurred which is explained in more detail below. The exception is assigned to class 'CX_SY_OPEN_SQL_DB' and was not caught in procedure"TABLE_DB_UPD" "(FORM)", nor was it propagated by a RAISING clause. Since the caller of the procedure could not have anticipated this exception, the current program was terminated.
The reason for the exception is: When an Open SQL array insert is performed, trying to insert a record into the database table "ZCLM_SLCONTROL" causes the function to terminate if a record with the same key already exists. (When an Open SQL individual record insert is performed, this situation does not cause the function to terminate. SY-SUBRC is set to 4 instead.)
**Start - Handling exceptions for Unique Indexes.
|>>>>>| INSERT (x_header-maintview) FROM TABLE <mod_elem_tab>.
* CATCH cx_sy_open_sql_db.
* MESSAGE i862(sv).
** End - Handling.
Could you please suggest how to prevent this issue ?
Kilian Kilger replied
for this scenario, there is the addition ACCEPTING DUPLICATE KEYS. So you can write:
INSERT ... FROM TABLE <mod_elem_tab> ACCEPTING DUPLICATE KEYS.
Then no exception is thrown but the sy-subrc is set to 4. All lines which could be inserted, will be inserted nevertheless.