abap material 04

20
Foreign Key Relationships BC030_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

Upload: warcraftc

Post on 21-May-2015

2.271 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: ABAP Material 04

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

Page 2: ABAP Material 04

Foreign Key RelationshipsBC030_04.2

Definition of Foreign Keys

Page 3: ABAP Material 04

Foreign Key RelationshipsBC030_04.3

Uses of Foreign Keys

• Maintain data integrity

• Provide help texts

• Create aggregate dictionary objects

Page 4: ABAP Material 04

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.

Page 5: ABAP Material 04

Foreign Key RelationshipsBC030_04.5

Check TableCheck Table

Value TableValue Table

Foreign Keys: Key Terminology

Foreign Key TableForeign Key Table

Page 6: ABAP Material 04

Foreign Key RelationshipsBC030_04.6

Check Table

Value

Table

Foreign Key Terminology: Check Table = Value Table

Page 7: ABAP Material 04

Foreign Key RelationshipsBC030_04.7

Foreign Key Terminology: Check Table Value Table

Check Table

Value

Table

Page 8: ABAP Material 04

Foreign Key RelationshipsBC030_04.8

DataDictionary

Establishing a Foreign Key Relationship in the ABAP Dictionary

Page 9: ABAP Material 04

Foreign Key RelationshipsBC030_04.9

Cardinality

n n : : m mn n : : m m1

C

1

C

N

CN

Page 10: ABAP Material 04

Foreign Key RelationshipsBC030_04.10

Course Enrolment

STUDENT_ID ?

Foreign Key Field Type

• Check Table: Students

• Foreign Key Table: Course Enrolment

Page 11: ABAP Material 04

Foreign Key RelationshipsBC030_04.11

Foreign Key Type: Key Fields or Key Field Candidates

Faculty Course

Page 12: ABAP Material 04

Foreign Key RelationshipsBC030_04.12

Foreign Key Type: Key Fields of a Text Table

T005(Country Codes)

(T002)(Language Codes)

T005T(Country descriptions)

Page 13: ABAP Material 04

Foreign Key RelationshipsBC030_04.13

Foreign Key Type: Non-Key Field Candidates

Course

Professor

Page 14: ABAP Material 04

Foreign Key RelationshipsBC030_04.14

Foreign key push-button

Creating a Foreign Key Relationship

Page 15: ABAP Material 04

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

Page 16: ABAP Material 04

Foreign Key RelationshipsBC030_04.16

Foreign Keys with Multiple Fields

Page 17: ABAP Material 04

Foreign Key RelationshipsBC030_04.17

Check TableCheck Table

Field-By-Field Assignment

Foreign Key TableForeign Key Table

Page 18: ABAP Material 04

Foreign Key RelationshipsBC030_04.18

Partial Foreign Keys

Page 19: ABAP Material 04

Foreign Key RelationshipsBC030_04.19

Constant Foreign Keys

“BIO”

Page 20: ABAP Material 04

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