‎2015 Oct 20 1:40 PM
| Category | ABAP Programming Error |
| Runtime Errors | DBSQL_DUPLICATE_KEY_ERROR |
| Except. | CX_SY_OPEN_SQL_DB |
| ABAP Program | SAPLZCLM_SLUPDATE |
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.
* TRY.
|>>>>>| INSERT (x_header-maintview) FROM TABLE <mod_elem_tab>.
* CATCH cx_sy_open_sql_db.
* MESSAGE i862(sv).
* ENDTRY.
** End - Handling.
Could you please suggest how to prevent this issue ?
‎2015 Oct 20 2:09 PM
Hi Dipin,
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.
Best regards,
Kilian.
‎2015 Oct 20 2:09 PM
Hi Dipin,
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.
Best regards,
Kilian.
‎2015 Oct 20 2:28 PM
Good day Dipin,
You can use MODIFY table. statement, because if the records exist on the db it will update the current record it won't dump. if the record does not exist it will create a new records.
syntax:
MODIFY db_tab FROM TABLE Internal table.
MODIFY db_tab FROM workarea.
Thanks,
Regards,
Tumelo Modise
‎2015 Oct 23 12:02 PM
‎2015 Oct 23 12:03 PM
‎2021 Sep 16 8:05 PM
Hello @Dipin Munjal
How did you solve this issue ? I am also getting similar dump while maintaining the entries from Custom SM30 view.
Regards,
Nikhil Kulkarni