Skip to Content
0
Former Member
Jan 23, 2009 at 07:10 AM

How to update database table with key field?

4337 Views

Hello Experts,

I have a database table with following fields

MATNR - Key

SSOUR - Key

KUNNR - Key

MENG1

MENG2

MENG3

And this table contains records like...

MSD50001 R 1000001 5.30 2.30 5.25

MSD50002 R 1000002 5.30 2.30 5.25

MSD50003 R 1000003 5.30 2.30 5.25

MSD50005 R 1000004 5.30 2.30 5.25

MSD50004 R 1000005 5.30 2.30 5.25

I have an internal table with same fields of above database table.

MSD50001 A 1000001 5.30 2.30 5.25

MSD50002 A 1000002 5.30 2.30 5.25

MSD50003 A 1000003 5.30 2.30 5.25

MSD50005 A 1000004 5.30 2.30 5.25

MSD50004 A 1000005 5.30 2.30 5.25

MSD50006 A 1000006 5.30 2.30 5.25

I want to update the DB table with following internal table records.

If internal table records = db table records are same then Update....else insert from internal table to db table.

But here, SSOUR is key field so i am not able to use

MODIFY dbtab from itab.

It results me , entries in internal table are inserted into db table.

So i have double records.

Is there any statement which updates the key field? and if no fields in db table then insert it?

Regards

RH