cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Change Key field in table

rajsapabap-tech
Explorer
0 Likes
905

Hi , I want to change custom table primary key. Already they are maintain WERKS,MATNR & MRP Area. I need to make VKORG as Key field in table but VKORG position also needs to correction. if i make the changes in table will it have any effect in existing data in the production server ?? 

Accepted Solutions (0)

Answers (2)

Answers (2)

Romanos
Product and Topic Expert
Product and Topic Expert

Hello @rajsapabap-tech ,

If you change the key fields, the table will need adjustment. See Adjustment of Database Structures .
This can lead to a loss of data, depending on the new table key and the availability of the table during the adjustment period. 

In your case you will probably not lose anything from the key change, since you are adding a key field, but the table will be unavailable to calling programms during the adjustment period and this can lead to runtime errors, loss of data etc. Meaning it can create problems somewhere else.

MKreitlein
Active Contributor
0 Likes

Hello @rajsapabap-tech 

I'm no ABAP developer but coming from BW side. Usually you cannot change table keys with data included in it.

You usually would create a second table with correct keys. Load the data there and correct the data how it is supposed to be. Then check and verify. Afterwards you clear the original table, adjust the keys and reload the updated data from the second table. Done 🙂

BR, Martin