DBSQL_DUPLICATE_KEY_ERROR

high

Unique Key Constraint Violated — Duplicate Record Insert Attempted

Module: ABAP / DBI

What this means

DBSQL_DUPLICATE_KEY_ERROR occurs when an INSERT or MODIFY statement attempts to write a record with a primary key that already exists in the database table. SAP normally prevents this via application-level checks, but the error surfaces when: two parallel postings race to insert the same key simultaneously; a number range object (SNRO) has a gap and reissues a previously used number; inconsistent Customising means a document type or account has duplicate sequence numbers; or a repair/correction program bypasses the normal document creation logic. This is distinct from DBSQL_TABLE_UNKNOWN — the table exists, but the specific key value is already occupied.

Recommended Fix

Check ST22 for the exact table name and key fields involved. In SE11, confirm the primary key definition. Review SM12 for lock entries on the affected object — a missing enqueue before the insert is a common cause of race conditions. Check SNRO for the relevant number range object and look for gaps or reset operations. If this is a transactional posting, check if parallel jobs are running against the same key range and serialise them.

Quick Info

ModuleABAP / DBI
Severityhigh
Diagnose in
ST22SE11SM12SNRO