0% found this document useful (0 votes)
192 views

Data Dictionary

The document discusses foreign keys in ABAP Dictionary. It defines foreign keys as fields that represent the primary key of another table. Foreign keys are used to maintain data integrity and provide help texts. When defining foreign key relationships, the foreign key field and primary key of the referenced table must share the same domain, and a value table must exist for that domain. The document also discusses terminology related to foreign keys and how to establish and maintain foreign key relationships in ABAP Dictionary.

Uploaded by

parthasc1982
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
192 views

Data Dictionary

The document discusses foreign keys in ABAP Dictionary. It defines foreign keys as fields that represent the primary key of another table. Foreign keys are used to maintain data integrity and provide help texts. When defining foreign key relationships, the foreign key field and primary key of the referenced table must share the same domain, and a value table must exist for that domain. The document also discusses terminology related to foreign keys and how to establish and maintain foreign key relationships in ABAP Dictionary.

Uploaded by

parthasc1982
Copyright
© Attribution Non-Commercial (BY-NC)
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
You are on page 1/ 20

Definition of Foreign Keys

 Relationships between tables are represented in the ABAP Dictionary by


foreign keys
 A foreign key is a field (or combination of fields) that represents the primary
key of another table

Slide 1 Foreign Key Relationships | 1.03 | September-2003


Uses of Foreign Keys
• Maintain data integrity
• Provide help texts
• Create aggregate dictionary objects

Slide 2 Foreign Key Relationships | 1.03 | September-2003


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

Slide 3 Foreign Key Relationships | 1.03 | September-2003


Foreign Keys: Key Terminology

 The table containing the set of allowed


Value Table
values attached to a domain

Check Table  The table that is referenced by a foreign


key

Foreign Key Table  The table containing fields that are


the primary key of the other table
Slide 4 Foreign Key Relationships | 1.03 | September-2003
Foreign Key Terminology:
Check Table = Value Table
 In many cases, the value table and the check table will be the same

Check Valu
Table e
Tabl
e

Slide 5 Foreign Key Relationships | 1.03 | September-2003


Foreign Key Terminology:
Check Table ≠ Value Table
 Sometimes check table is another table containing a subset of the records in
a value table.

Check
Table Valu
e
Tabl
e

Slide 6 Foreign Key Relationships | 1.03 | September-2003


Establishing a Foreign Key
Relationship in the ABAP
Dictionary
 During defining Foreign Key Relationship, system suggests a Foreign Key
Relationship for you.

Data
Dictionary

Slide 7 Foreign Key Relationships | 1.03 | September-2003


Cardinality
 When creating foreign key relationships, you should always specify the cardinality
of that relationship

n : m
1 1

C C

CN

Slide 8 Foreign Key Relationships | 1.03 | September-2003


Creating a Foreign Key
Relationship

Foreign key push-button

Slide 9 Foreign Key Relationships | 1.03 | September-2003


Maintaining a Foreign Key
Relationship’s Attributes

Enter a description (short text).


Check table

Maintain foreign
key type Maintain cardinality n : m

Slide 10 Foreign Key Relationships | 1.03 | September-2003


Foreign Keys with Multiple
Fields
 If the primary key of a check table has multiple fields (i.e. it has a composite primary
key), some type of assignment must be made for each field when creating a foreign
key relationship.

Slide 11 Foreign Key Relationships | 1.03 | September-2003


Field-By-Field Assignment
 When performing a field-by-field assignment, all key fields in the check table are
used to determine valid entries in the foreign key table.

Foreign Key Table Check Table

Slide 12 Foreign Key Relationships | 1.03 | September-2003


Partial Foreign Keys
 When creating a partial foreign key, certain fields are flagged as generic
 These fields are ignored by the system when validating records that are inserted
into the foreign key table.

Slide 13 Foreign Key Relationships | 1.03 | September-2003


Constant Foreign Keys
 When creating a constant foreign key, certain fields are assigned a literal value
 Only records in the check table with that value in the corresponding field are used
to determine whether records in the foreign key table are valid.

O ”
BI

Slide 14 Foreign Key Relationships | 1.03 | September-2003


Combined use of Partial and
Constant foreign keys

Generic foreign key

Constant foreign key

Slide 15 Foreign Key Relationships | 1.03 | September-2003


Including Structures in Tables
 Structure is a group of internal fields that logically belong together

Customer Tables SAP


Tables
Substructures Customizing Includes
Table YCUSTAB Table XYZ
.INCLUDE YSTRUC .INCLUDE CI_XXX

Append Structures

Field 1 Table T
Field 2
... .APPEND ZAT
Field n
SAP Tables
Including Structures in Tables
(Continued..)
Customer Tables SAP
Tables
Substructures Customizing Includes
Table YCUSTAB Table XYZ

.INCLUDE YSTRUC .INCLUDE CI_XXX

Append Structures
Table T
Field 1
Field 2 .APPEND ZAT
...
Field n
SAP Tables
Substructure
YS YS-F1 YS-F2 YS-F3...

Table Field Data element


YT1 S1
(TRANSP) S2
.INCLUDE YS
F1

Table Field Data element


YT2 S1
(TRANSP) S2
.INCLUDE YS
F1
Customizing Include

CI_XXX CI_XXX-F1CI_XXX-F2CI_XXX-
F3

Table
Table Field
Field Data
Data element
element

XYZ
XYZ S1
S1
F1
F1
.. .. ..
Fn
Fn

.INCLUDE CI_XXX
Append Structure
ZAT ZAT-F1 ZAT-F2 ZAT-F3

Table Field Data element

T S1
F1
...
Fn

.APPEND ZAT

You might also like