2005 Jun 29 11:32 PM
Hello Guys,
I deleted a primary key field in a custom table by clicking 'delete row' icon and then tried activating it through se14 - database utility. It is throwing an error saying 'Primary key change not permited for the value table zxxxx'. What is the problem???
How can I delete a primary key in a table??
Please help.
Thanks,
Naren
2005 Jun 29 11:34 PM
I am pasting the detail explaination over that error.
Primary key change not permitted for value table ZTV_RANGE_NUMBER
Message no. AD 300
Diagnosis
This table is defined as a check table. For reasons of consistency, changes to the primary key of the table are not allowed.
Procedure
If it is essential that you change the primary key, you must delete the relevant foreign keys. Refer to the where-used list to find all tables containing a field that is checked against this table. Delete the foreign keys for these fields.
If necessary, maintain the deleted foreign keys again.
2005 Jun 30 2:36 AM
Hi,
To ensure referential integrity, you must first delete all data from related/child tables that contain this key. Then delete the foreign key relationship from SE11. Once that is done, you can delete the key from your table and use txn SE14 to adjust and activate the table. You may lose some data if this key removal results in duplicate records in your table.
Regards
2005 Jun 30 6:02 AM
Hi,
Try deleting the foreign key of the primary key which you deleted as explained in procedure.
Procedure
If it is essential that you change the primary key, you must delete the relevant foreign keys. Refer to the where-used list to find all tables containing a field that is checked against this table. Delete the foreign keys for these fields.
2005 Jun 30 7:26 AM
Hi,
You can delete the primary key form the table. But if that primary key acts as a foreign key in another table then dependencies exist.
So, first you should delete all the matching entries from the table in which the primary acts as a foreign key. Then you can very well delete the primary key from the master table.
Thanks & Regards,
Venkat Ramanan
2005 Jun 30 4:54 PM
Hello folks,
Thanks a lot for your replies.
I deleted all the relevant foreign keys but still I am getting that error. I also had commented out some lines in my code where ever I was using the field I want to delete. But still no success. Any guesses???
Thanks,
Naren