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

ABAP dump analysis

former_member602116
Participant
0 Likes
4,350

Hi Experts,

We have encountered a dump in production where insert statement fails to update a custom database table.The internal table that contains the entries that updates the database table is IT_LABELS. As can be seen in below screenshot, IT_LABELS contains two entries:

Scrolling down*

My question is, are these two entries the contents of table IT_LABELS?

If so, as both entries are identical, is this what's causing the dump. I have checked this entry in the database table, however it still does not exist. Does insert statement fail when the internal table source contains identical entries (same primary keys) even though that entry does not exist in the database yet?

1 ACCEPTED SOLUTION
Read only

MateuszAdamus
Active Contributor
4,203

Hello kdarunday

Yes, these are the entries in the IT_LABELS table.

Yes, the INSERT will fail if the primary key or a unique index is violated.

If you try to insert the two entries at the same time, then the INSERT statement will fail regardless if the first record with the same key is already in the DB table or not. Because for the INSERT, the first record is already in the table when trying to insert the second one.

When the statement fails no database change is committed, hence you cannot see any of the records in the DB table.

Kind regards,
Mateusz
7 REPLIES 7
Read only

MateuszAdamus
Active Contributor
4,204

Hello kdarunday

Yes, these are the entries in the IT_LABELS table.

Yes, the INSERT will fail if the primary key or a unique index is violated.

If you try to insert the two entries at the same time, then the INSERT statement will fail regardless if the first record with the same key is already in the DB table or not. Because for the INSERT, the first record is already in the table when trying to insert the second one.

When the statement fails no database change is committed, hence you cannot see any of the records in the DB table.

Kind regards,
Mateusz
Read only

0 Likes
4,203

Hi Mateusz,

Does this mean the first entry is rolled back? Or is it only at runtime that INSERT considers the first record as already in the table?

Regards,

Katherine

Read only

0 Likes
4,203

That's exactly what it means, Katherine.


Kind regards,
Mateusz
Read only

0 Likes
4,203

Thanks for the clarification, Mateusz!

Regards,

Kath

Read only

FredericGirod
Active Contributor
4,203

When you insert data from a not checked area (file, human, ...) you could add the parameters ACCEPTING DUPLICATES to the INSERT statement

https://help.sap.com/doc/abapdocu_751_index_htm/7.51/en-us/abapinsert_source.htm

Read only

0 Likes
4,203

Hi Frederic,

Thanks for the suggestion, I'm also thinking to delete adjacent duplicates from the internal table. But with accepting duplicates, will both entries be added? or only one but will not encounter a dump upon insert?

Regards,

Kath

Read only

4,203

kdarunday, with "ACCEPTING DUPLICATE KEYS", in your case if the duplicates are only in your internal table, only the first unique records will be inserted, all duplicate entries will be discarded. If the duplicates already exist in the database and your internal table, all duplicates in the internal table will be discarded.

If you dont use "ACCEPTING DUPLICATE KEYS", you can catch the error with CX_SY_OPEN_SQL_DB, and the insert will be stopped, once a duplicate key is encountered and only the first unique records will be in the database.

If you neither use "ACCEPTING DUPLICATE KEYS" nor catch the error CX_SY_OPEN_SQL_DB, you will end up with the dump that you have encountered and no records will be inserted at all.