Application Development and Automation 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: 
Read only

key..

Former Member
0 Likes
1,326

Hi abapers !

how many primary key can we put for a table ?

we can put only one primary key or

we can put as many as we can ..!

( i hear that we can have more than one field Combination as primary key but not more than one primary key

( what does the term combination mean ) )

Regards,

Rajesh.

Edited by: rajesh k on Apr 9, 2008 9:37 AM

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,280

Ther can be only one primary key for a table.

combination of fields as a secondary key to identify unique records

There is only ONE primary key, however this key can of course consist of multiple fields / columns. You do have secondary keys as well, namely indexes. Basically one can create N-number of secondary keys, but in practice one should not do this because on overload of secondary keys can influence performance negatively or at least it will no longer speed up things.

12 REPLIES 12
Read only

Former Member
0 Likes
1,281

Ther can be only one primary key for a table.

combination of fields as a secondary key to identify unique records

There is only ONE primary key, however this key can of course consist of multiple fields / columns. You do have secondary keys as well, namely indexes. Basically one can create N-number of secondary keys, but in practice one should not do this because on overload of secondary keys can influence performance negatively or at least it will no longer speed up things.

Read only

Former Member
0 Likes
1,280

Hi,

There Could be Many primary key fields in a table.

Eg. In MARA table there are two primary key fields MANDT,MATNR

Combination Means if u make 3 primary key fields in a table this makes the combination as a primary key for the table.

Then at the time of inserting record the combination of three keys cant have same record the records should be unique for that combination.

regards

Sandipan

Read only

Former Member
0 Likes
1,280

Hi Rajesh,

You can have as many primary keys in a table as you require.

To make a field a primary key just click the 'KEY' box next to the field name while creating the table in SE11.

Note : The primary keys have to be the first few fields of the table followed by the remaining fields.

Reward if helpful,

Regards,

Esha Raj

Read only

Former Member
0 Likes
1,280

Hi,

There can be only one primary key in the table. However this primary key may consists of the combination of many columns.

Supriya.

Read only

Former Member
0 Likes
1,280

hai

rajesh,

we can create only one primary key in a table.A primary key can create as a combinations of fields. it is not possible to create more than one primary key per a table according to database rules.

if it useful , reward marks.

bye

G.V.K.Prasad

Read only

Former Member
0 Likes
1,280

You can have as many primary keys in a table as you require.

To make a field a primary key just click the 'KEY' box next to the field name while creating the table in SE11.

Note : The primary keys have to be the first few fields of the table followed by the remaining fields.

With Rgds,

S.barani

Read only

Former Member
0 Likes
1,280

Hi

you can maintain more than one primary key for a table, but only issue is you will not get the uniqueness of the records stored in the table.

If you have multiple primary keys, records will be stored based on composite key concept, which may allow multiple entries based on number of Primary key you defined.

Apart from that no other issue, upto my knowledge.

Thanks & Regards,

Reward points if useful.

Read only

Former Member
0 Likes
1,280

Hi,

There can be more than one primarykeys in the table.

The word combination means that the combination of the fields is unique for that table.

The combination acts as primary key.

Read only

Former Member
0 Likes
1,280

Hi,

we can create how many primary keys we want...refer any standard tables..they have both mandt and etc....

Thank u,

Manjula Devi.D

Read only

Former Member
0 Likes
1,280

hi,

U can have many primary keys... there is no limitation. but it is the best option to use forign key aspect to check for combining different tables with some unique identifiers (Primary key) between these tables.

The combination, inturn refers to the way these keys, both primary and secondary keys, are used for a particular combination of fields between different tables.

Reward if helpfull.......

any queries.....

Read only

Former Member
0 Likes
1,280

hi rajesh ,

you can have N number of primay key , were N is the total nuber of fields.

all this from a composite primary key.

Suppose you create only one key field , that patricular field will accept only the unique values

if you have composite primary key , then the table will accept entries , where the comination of all the

key fields is unique.

Read only

Former Member
0 Likes
1,280

Hi Rajesh,

You can define Primary key upto 16 or upto 324 length.

Means; suppose u take one primary key whose length is 324, then u can not assign another primary key.