Application Development 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: 

Problems deleting a primary key field in a table.

Former Member
0 Kudos
1,837

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

5 REPLIES 5

Former Member
0 Kudos
302

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.

0 Kudos
302

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

0 Kudos
302

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.

Former Member
0 Kudos
302

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

0 Kudos
302

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