Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Error: SAPSQL_ARRAY_INSERT_DUPREC

Former Member
0 Likes
424

Dear all,

I try to test a little program that I use for my training in ABAP.

My target is to copy all content of table USR02 into another table (ZUSR02 yet created into ABAP Dictionary with transaction SE11, and with the same schema of USR02 table)

The code that I try to execute is the follow:


REPORT  ZTEST.

TABLES: USR02,ZUSR02.

DATA all_users LIKE USR02 OCCURS 1000 WITH HEADER LINE.

DELETE FROM ZUSR02 client specified.

SELECT * FROM USR02  client specified  INTO TABLE all_users .

insert ZUSR02 from table all_users.

but when I try to execute, I obtain this DUMP:

Runtime Errors SAPSQL_ARRAY_INSERT_DUPREC

Except. CX_SY_OPEN_SQL_DB

Date and Time 06.06.2010 22:41:31

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 "!PROVA" 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

and

therefore caused a runtime error.

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.)

2 REPLIES 2
Read only

Former Member
0 Likes
373

First of all, this isn't a training forum for ABAP. You should get some books and do some training.

In this case, you should check sy-subrc after each database operation so that you know if you want to continue or do something else.

Rob

Read only

Former Member
0 Likes
373

closed