10-05-2007 3:05 PM
hi experts
Normally databases wont allow more than one primary key..but SAP allows to create more than one primary key... then wats the use of creating primary keys..
correct me if im wrong..
10-05-2007 3:07 PM
hi
good
We can have max 16 fields in Primary key for a Table.
This is the standard limit in most of the Databases.
thanks
mrutyun^
10-05-2007 3:08 PM
You can have only one <u>primary</u> index, but you can have multiple <u>secondary</u> indeces. These are created to speed up SELECTs on these fields.
Rob
10-05-2007 3:10 PM
Hi,
Primary jeys is nothing but we can save the data without any duplicate records, lets take MM, we have PLANT nad material, if we take only PLANT as primary key, then we can enter the repeted Materila number, that is nothing but the Duplicate, so if we take these 2 are primary keys, then we can not enter the duplicate records into the database
Regards
Sudheer
10-05-2007 3:13 PM
k let u solve tis problem... tis s my actual problem
i create an ztable for employee details...
in that i declare empcode and accessno fields as primary keys
while entering data it allows same access code for different employees
but i wan the accesscode field as a uniquekey... thus repitation of
value in that field should not allowed... is there any option in DDIC
for declaring particular field as unique field
ie if we declare more than one key as primary key it allows only one
data for combination of that all primary key fields but allows repeated
datas for a single field, is there any option to avoide that repetation
for a paticular field.
thanks & regrds,
Arun
10-05-2007 3:16 PM
Try creating an index on that field and declare it as a unique index.
Rob
10-05-2007 5:21 PM
Hi Arun Kumar,
When you define the EMPLOYEE CODE and ACCESS CODE as fields of the primary key, you are telling SAP that you would like to maintain a unique combination of EMPLOYEE CODE and ACCESS CODE. This means that you could have multiple employees with the same ACCESS CODE.
If I understand you correctly you want the ACCESS CODE to be unique for each employee. The solution is simple. Define only the ACCESS CODE as the primary key. Let the EMPLOYEE CODE be an ordinary field. If for any particular reason you would like to access this table using the EMPLOYEE CODE and not the ACCESS CODE, create a secondary index on EMPLOYEE CODE.
10-05-2007 3:11 PM
HI Arun,
In order to provide performance in SAP we use more than 1 primary key, primary key maintains index.
Regards,
Prasad
10-05-2007 6:01 PM
Hi,
To correctly say, SAP allows only one Primary Key on a table.But it allows to create more than one index on a table.
Primary Key: A combination of field(s) to uniquely identify a record in a table.Also known as primary index.
Index: Indexes are used to improve the performance while retrieving the data(records) from DB table.
Normally records will be arranged in a certain order in the table along with the index name if an index is created on certain field(s). If the fields specified in the index is used to query the table, then data retrieval will be fast.
In case, if one does not have a primary key fields to query the table,then he can consider using the fields specified in the index to retrieve the records.
Hope this helps.
Regards,
Dilli
10-10-2007 1:52 PM
Hi Arun,
In SAP also you can have only one primary key. Primary key means a field or combination of fileds which uniqely identify a record in a table. That means a primary can be created basedon a single or a combination of one or more (less than 16) fileds. in your case the table has got a primary key which is a combiantion of employ code and access code. So the combiantion 1000 AA, 1000 AB, 1001AA are different key combinations. Thats is why your table is accepting same emplloy code for different records. Hope it clears your doubt.
Regards,
Aby Chacko
Reward if helpful