‎2010 Feb 17 9:59 AM
Hi Experts,
I am getting the below exception daily in ST22. Please suggest any resolution
Runtime Errors SAPSQL_ARRAY_INSERT_DUPREC
Exception CX_SY_OPEN_SQL_DB
Short text
The ABAP/4 Open SQL array insert results in duplicate database records.
What happened?
Error in the ABAP Application Program
The current ABAP program "SAPLCRM_ORDERADM_H_DU" had to be terminated because
it has
come across a statement that unfortunately cannot be executed.
Error analysis
An exception occurred that is explained in detail below.
The exception, which is assigned to class 'CX_SY_OPEN_SQL_DB', was not caught
in
procedure "CRM_ORDERADM_H_UPDATE_DU" "(FUNCTION)", nor was it propagated by a
RAISING clause.
Since the caller of the procedure could not have anticipated that the
exception would occur, the current program is terminated.
The reason for the exception is:
If you use an ABAP/4 Open SQL array insert to insert a record in
the database and that record already exists with the same key,
this results in a termination.
(With an ABAP/4 Open SQL single record insert in the same error
situation, processing does not terminate, but SY-SUBRC is set to 4.)
Regards,
Amit nanda
‎2010 Feb 17 10:22 AM
Hi,
The Problem is that you are trying to insert a record which is already present in the database table with the same combination of primary keys.
for eg,
in table Z_TAB in database
Primary keys are : A
B
C
and there is a record in the table
A B C D E
and you try to insert the record
A B C F G
then as the primary keys are matching, according to the database rule it is not allowed to insert 2 records with same primary key combination and the program dumps.
‎2010 Feb 17 11:25 AM
hi,
In your program logic entry of fields repeated through sql statement .....you can come over to this exception through by check in condition by which you are inserting the data.....OR Simply catch the given exception between the Try ...Endtry.
Regards
Gaurav
‎2010 Feb 17 12:15 PM
Dear Amit,
You are getting this dump becuase program is trying to update the entry in database table but the entry with same primary key is already exist in database table.
To avoid this dump you shold follow the below procedure
1. Sort your internal table
2. Now delete all the duplicate entries from this table by comparing key fields.
‎2010 Feb 17 12:58 PM
I think you are trying to insert duplicate records which might be present in DB either while updating itselt you must be having duplicate records..
Check primary keys..
please check...if second case then use Delete adjacent duplicates...