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

regarding insert statement

Former Member
0 Likes
571

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
Read only

harimanjesh_an
Active Participant
0 Likes
548

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

Read only

Former Member
0 Likes
548

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

Read only

Former Member
0 Likes
548

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

Read only

Former Member
0 Likes
548

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