Foreign Key RelationshipsBC030_04.1
Foreign Key Relationships
• Definition & Uses of Foreign Keys
• Prerequisites for Constructing Foreign Key Relationships
• Key Terminology
• Cardinality and Foreign Key Field Types
• Foreign Keys with Multiple Fields
Foreign Key RelationshipsBC030_04.2
Definition of Foreign Keys
Foreign Key RelationshipsBC030_04.3
Uses of Foreign Keys
• Maintain data integrity
• Provide help texts
• Create aggregate dictionary objects
Foreign Key RelationshipsBC030_04.4
Prerequisites for Constructing Foreign Key Relationships• The foreign key field and the primary key of the
check table must share the same domain.
• A value table must exist for that domain.
Foreign Key RelationshipsBC030_04.5
Check TableCheck Table
Value TableValue Table
Foreign Keys: Key Terminology
Foreign Key TableForeign Key Table
Foreign Key RelationshipsBC030_04.6
Check Table
Value
Table
Foreign Key Terminology: Check Table = Value Table
Foreign Key RelationshipsBC030_04.7
Foreign Key Terminology: Check Table Value Table
Check Table
Value
Table
Foreign Key RelationshipsBC030_04.8
DataDictionary
Establishing a Foreign Key Relationship in the ABAP Dictionary
Foreign Key RelationshipsBC030_04.9
Cardinality
n n : : m mn n : : m m1
C
1
C
N
CN
Foreign Key RelationshipsBC030_04.10
Course Enrolment
STUDENT_ID ?
Foreign Key Field Type
• Check Table: Students
• Foreign Key Table: Course Enrolment
Foreign Key RelationshipsBC030_04.11
Foreign Key Type: Key Fields or Key Field Candidates
Faculty Course
Foreign Key RelationshipsBC030_04.12
Foreign Key Type: Key Fields of a Text Table
T005(Country Codes)
(T002)(Language Codes)
T005T(Country descriptions)
Foreign Key RelationshipsBC030_04.13
Foreign Key Type: Non-Key Field Candidates
Course
Professor
Foreign Key RelationshipsBC030_04.14
Foreign key push-button
Creating a Foreign Key Relationship
Foreign Key RelationshipsBC030_04.15
Enter a description (short text).
Maintain cardinality n : m
Maintain foreignkey type
Check table(defaults tovalue table)
Maintaining a Foreign Key Relationship’s Attributes
Foreign Key RelationshipsBC030_04.16
Foreign Keys with Multiple Fields
Foreign Key RelationshipsBC030_04.17
Check TableCheck Table
Field-By-Field Assignment
Foreign Key TableForeign Key Table
Foreign Key RelationshipsBC030_04.18
Partial Foreign Keys
Foreign Key RelationshipsBC030_04.19
Constant Foreign Keys
“BIO”
Foreign Key RelationshipsBC030_04.20
Generic foreign keyGeneric foreign keyGeneric foreign keyGeneric foreign key
Constant foreign keyConstant foreign keyConstant foreign keyConstant foreign key
Changing the Field Assignment
Top Related