When inserting data with the ABAP/4 language command
INSERT INTO
the error that the record already exists is generated, although no record exists with the entered primary key. This error situation means that either SY-SUBRC = 4 after executing the operation, or results in the runtime error SAPSQL_ARRAY_INSERT_DUPREC.
Cause and prerequisites
There are two possible causes for this
- 1. In addition to the primary key, there also exists a further secondary key for which the UNIQUE constraint was also required. This possibility can best be checked directly on the database by evaluating the corresponding database catalog tables.
- 2. A trigger was defined (by the customer) on the INSERT operation so that the INSERT also uses INSERT operations on other tables which can have UNIQUE constraints on their part. This is also best verified by inspecting the corresponding database catalog tables.
The solution now depends on the respective cause.
- 1. If a secondary index exists, check out its sense and purpose. Was this possibly only created by the customer due to incorrect assumptions?
- 2. Triggers are not delivered by SAP. That is, clarify the origin of the trigger with which customer. The transaction runs as soon as this is eliminated.
UNIQUE Index, UNIQUE constraint, Database trigger
No comments:
Post a Comment