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

How to avoid dump error while inserting records into database table

JayR
Participant
0 Likes
2,492

Hi,

While inserting records in database table, i am getting dump error due to the duplicate entries. How should i avoid the dump error and throw some warning messages

thanks in advance

Useful answers will be rewarded

5 REPLIES 5
Read only

Former Member
0 Likes
1,261

check the data in database table before inserting,if data is exists in database and then show message..

if you use Modify statment and then you will not get short dump.

Message was edited by:

Seshu Maramreddy

Read only

Former Member
0 Likes
1,261

if you use a modify statement, u wont get dump. as modify will modify the existing entry, if an entry exists, else, insert new entry..

if you are particular about insert, then, select from dbtab for the current value in internal tab. if it exists, then display message.

Read only

0 Likes
1,261

Thanks for the reply. The problem is not with the values in the existing database. The duplicate entries might be in the records which has to be inserted. Even if there is no value for key field in 2 records might result in duplicate entries. Actually i want to know is there any option like TRY ... CATCH to avoid this situation

Read only

0 Likes
1,261

Hi Jai,

After insert statement.

If sy-subrc NE 0.

continue.

endif.

Regards

SAB

Read only

uwe_schieferstein
Active Contributor
1,261

Hello Jai

There are two options available:

(1) Sort the itab containing the new entries by the key fields and remove duplicates prior to the INSERT into the DB table

(2) Use the INSERT statement with the option ACCEPTING DUPLICATE KEYS

While these options <i>technically </i>solve the problem by avoiding dumps it is up to you to define whether these options are <i>semantically </i>correct.

Regards

Uwe