‎2007 Nov 19 1:06 PM
Hi,
can anybody suggest me the way for below requirement,
i want to insert record(s) from internal table to database table, before that i have to check whether that database table contains the same record(s) which we are about to insert? and then insert if the "one"(record(s)) was not there.
can u suggest any simple way for this.
‎2007 Nov 19 1:11 PM
Hi Kranthi,
First select all the data from DB table into <itab1> for all entries in ITAB2.
ITAB2 is your internal table
Loop at <itab2> into wa.
READ Table <itab1> into wa1 with key wa-keyfield.
If sy-subrc <> 0.
update wa values to DB Table.
Endif.
ENDLOOP.
<b>Reward Points if this helps</b>
Satish
‎2007 Nov 19 1:11 PM
Hi Kranthi,
First select all the data from DB table into <itab1> for all entries in ITAB2.
ITAB2 is your internal table
Loop at <itab2> into wa.
READ Table <itab1> into wa1 with key wa-keyfield.
If sy-subrc <> 0.
update wa values to DB Table.
Endif.
ENDLOOP.
<b>Reward Points if this helps</b>
Satish
‎2007 Nov 19 1:11 PM
Hi,
Make Primary Key in Database table so it will give error internally when u inserting duplicte records.
Regards
Gagan
‎2007 Nov 19 1:12 PM
Use the Modify statement. If the record already exists it wil update the existing record, else it will insert a new record into the database.
http://help.sap.com/saphelp_nw04/helpdata/en/fc/eb3ac8358411d1829f0000e829fbfe/content.htm
Regards,
Abhishek
Message was edited by:
Abhishek Jolly