‎2008 Feb 17 3:43 AM
‎2008 Feb 17 4:38 AM
Foreign Keys
You can define the relationships between tables in the ABAP Dictionary by creating foreign keys.
Using foreign keys, you can easily create value checks for input fields. Foreign keys can also be used to link several tables in a view or a lock object
Table T1 is called the foreign key table (dependent table) and table T2 the check table (referenced table). The pair of fields for the two tables must have the same data type and length. One field of the foreign key table therefore corresponds to each key field of the check table. This field is called the foreign key field.
A foreign key permits you to assign data records in the foreign key table and check table. One record of the foreign key table uniquely identifies one record of the check table using the entries in the foreign key fields.
Check this link for more
http://help.sap.com/saphelp_nw70/helpdata/en/cf/21ea77446011d189700000e8322d00/content.htm
Primary Keys
For some applications, it is useful to uniquely identify the rows in a table by one or more columns so that you can process them in a specified sequence, for example. You can do this by assigning a primary key. The column names that are to create the table key are represented by the keywords PRIMARY KEY. The input values of the key columns defined in this way must not be a NULL value.
You can use the primary key to insert rows in a table in the same way as you insert rows in a base table when no primary key is defined. However, the system outputs an error message if you attempt to insert an existing value into the primary key column a second time, since the uniqueness of the column is ensured by defining the primary key.
A primary key can consist of multiple columns. However, it is unusual for a key to be constructed from more than five columns, since this makes it difficult for users to enter unique values. The arrangement of the columns behind the keywords PRIMARY KEY defines the key sequence.
Check this link for more..
http://help.sap.com/saphelp_nw04s/helpdata/en/3c/384c4005a99523e10000000a1550b0/frameset.htm