Application Development 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: 

regarding insert statement

Former Member
0 Kudos

Hi to all........

1.......If i use insert key word in my report for inserting a record into database table.

but unfortunatly that record is exiting in the database table.now if i proceed with my inset statement what will happen exactly. wether the record will insert or not.

regards,

k.swaminath

4 REPLIES 4

harimanjesh_an
Active Participant
0 Kudos

hi swaminath,

Insert statement will fail if the record already exist with the same key elements.......

Example, In MARA table we cant have two entries fro same Material(MATNR) since MA?TNR is the Key field for MARA's records.

<b><REMOVED BY MODERATOR></b>

Harimanjesh AN

Message was edited by:

Alvaro Tejada Galindo

Former Member
0 Kudos

Hi,

You can't use INSERT command for primary key which is already available in the table.

If you use it will throw the sy-subrc value 4.

and your new record will not be saved in the table.

no damage for the exixting record

Former Member
0 Kudos

Hi,

If you try to insert a record that already existed in a databse table, the statement will fail and SY-SUBRC will be set to 4.

Regards,

Nicolas

Former Member
0 Kudos

If you simply say INSERT, it will dump trying to insert a duplicate record; howver, if you say INSERT...ACCEPTING DUPLICATE KEYS, you will get a return code of 4 and the record will be inserted. In this case, you will only see the last record inserted.

Rob