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

regarding ABAP-dictionary

Former Member
0 Likes
625

Is it possible two primary keys for one database table ? tell me indetail

5 REPLIES 5
Read only

Former Member
0 Likes
593

hi

yes the tables can have one or more primary keys...the combination then becomes primary key(composite key)

for ex:

in the table VBAP - VBELN & POSNR are both primary key fields.

the combination of keys that you define as 'KEY' while creating a DB table becomes primary key.

regards,

madhu

Read only

shishupalreddy
Active Contributor
0 Likes
593

Hello Amar,

It is possible to have more than one primary key anyhow u can see in anyof the table u can find two primary keys in which on is Client (mandt) and atleast a single primary key field related to the table .

so u can have ..........

regards

Read only

Former Member
0 Likes
593

Hi Reddy,

Welcome to SDN...

Yes, You can have one or more keys to be primay keys for a table.

These primay keys combination is called composite primay key and it will uniquely identifies an entry in a database table.

When creating database table, Give the Key field to be check for the fields which you want to be primay keys.

Thanks,

Vinay

Read only

Former Member
0 Likes
593

HI,

U can have two or more fields in the primary key of a db table. This type of key is composite primary key. but u can't have more than one primary key for a table, i.e more than one composite primary key.

Combination of primary key fields uniquely identifies the record present in the data base table.

Read only

former_member196299
Active Contributor
0 Likes
593

hi Reddy,

You can have multiple primary keys in ur transparent table .

The group of primary keys are called as composite Key .

For all the fields you want to define as a primary key ,tick mark the respective fields on the right side .

General you should keep all the primary keys on the top of your Trans. Table.

While writing a select querry use the max number of primary keys as that helps

in better performance.