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: 

Hi All,How2 delete a pkey for std table and add 2 new primary keys

Former Member
0 Kudos

Hi All,

How2 delete a pkey for std table and add 2 new primary key fields .Please provide me the required procedure .

Thanks&Regards.

Bharat.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

The primary key fields on any standard table will be used in SAP programs, Transactions, view, etc. Changing them in any way will break the SAP code.

If you need data access by a different key - set up an index. Do not change the key.

As another alternative - set up a Z table with the new key you want, and with data fields that include the SAP primary key - you can then use "JOIN" between this and the SAP table to read the data.

Post details of which table you want to do this to and why, to see what others have to say about other ways of achieving your result.

Andrew

4 REPLIES 4

Former Member
0 Kudos

hi bharat,

u can delete a primary key and add 2 new primary keys...but before that u need to check for these constraints:

1) check whether this table primary key is used in anothe table as foreing key. if so u need to remove this relation.

2) delete all the records from that table.

hope this may help u...

please reward incase usefull...

regards,

prashant

Former Member
0 Kudos

Hi Bharat,

First thing is you need to have the access key to change any standard dictionary object/standard programs/ standard transactions.You may get this from your basis person after getting approval from your respective manager.But changing or modifying the standard object is not recommended, but if there is no alternate to meet the business requirement then we have to follow this way only.

Next, you need to check whether this table's primary key is being used in any other table as foreing key or not. If there is, then you must remove this relation and then you can delete the unncessary primary key field from that table.Finally you can add the two new fields and set them as primary key, save, check for any errors and activate.

Hope this helps.

Please reward if useful.

Thanks,

Srinivasa

alejandro_bindi
Active Contributor
0 Kudos

I'd like to know based on what requirement you need to change a standard table primary key. That's really ugly...

Have you exausted all other possibilities?

Regards.

Former Member
0 Kudos

The primary key fields on any standard table will be used in SAP programs, Transactions, view, etc. Changing them in any way will break the SAP code.

If you need data access by a different key - set up an index. Do not change the key.

As another alternative - set up a Z table with the new key you want, and with data fields that include the SAP primary key - you can then use "JOIN" between this and the SAP table to read the data.

Post details of which table you want to do this to and why, to see what others have to say about other ways of achieving your result.

Andrew