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

SAPSQL_ARRAY_INSERT_DUPREC Exception

omar_elkassi2
Explorer
0 Likes
1,227

Hi Expert,

I have a serieus problem in a specifique programm. during Execution i Have a SAPSQL_ARRAY_INSERT_DUPREC exception. when i check in the ST22 i have the details below :

error source : " >>>>> insert (x_tabname) from table x_profval."

Variable values a the time of the exception : X_TABNAME refers to " EPROFVALMONTH" table.

values of xprofval_ key fields are : 000000000001066507 and 20110801 as date.

when I check tha table X_PROFVAL for entries with this Key values, i don't found records. so i can't understand how can i have a duplicated ket Insert problem if no data exist in this Table.

Thanks a lot,

Omar.

5 REPLIES 5
Read only

Former Member
0 Likes
999

The duplicates are in EPROFVALMONTH, not X_TABNAME.

Rob

Read only

0 Likes
999

Exectly. sorry for the writing mistak. i checked EPROFVALMONTH where no records found four my key fields.

Read only

0 Likes
999

The dump will not only be if the key entry already exist in the database table but also if the Internal table x_profval has two rows with same key values ( "000000000001066507" and "20110801" ) at the time of Insert.

Read only

0 Likes
999

To analysis the issue, I will suggest to add the try catch block.

TRY .

INSERT ZTAB FROM wa.

CATCH sapsql_array_insert_duprec.

Write : wa. " You can write the key fields only,

ENDTRY.

If you are inserting from internal table, then loop it and write the key fields. So from the output you can get the particular data.

Hope this will help your analysis.

Thanks

Subha

Read only

raviahuja
Contributor
0 Likes
999

Hi,

Or you can use 'ACCEPTING DUPLICATE KEYS' in front of your insert statement. It won't give you dump at least. But make sure remove all duplicate entries for your table primary key. You can do this by sorting by primary key and using DELETE ADJACENT ENTRIES.

Thanks.

Ravi