Escolar Documentos
Profissional Documentos
Cultura Documentos
Foreign key is nothing but simply we can say, "a field in one table related to field in
another table". See the below example:Consider, there are two tables like emp_personal and emp_official.
In emp_personal table , the fields are empid, empname, dob for example. In this table,
empid is the primary key field.
In emp_official table, the fields are empid, dept, designation for example. In this also,
empid is the Primary key or may not be a Primary key field.
Now we relate these two tables using the foreign key relationship. Foreign key
relationship is used to avoid the redundancy mainly.
Now, emp_personal is the Check table (Because it holds the empid field, which has
the primary key...)
emp_official table is the Foreign key table (Because it holds the empid field, which
may or may not be a Primary key).
Now, the foreign key relationship is given. (click the KEY Like icon in ABAP Dict Database Table : Emp Official )
Tables are ready to enter the records...for example create some 5 records in the
emp_personal table .
Table : emp_personal : Primary Key - empid
empid
--------1
2
3
4
5
empname
-------------AAA
BBB
CCC
DDD
EEE
empdob
-----------1.1.1990
2.2.1990
3.3.1990
4.4.1990
5.5.1990
Status
--------------------Record saved successfully
Record saved successfully
Record saved successfully
Record saved successfully
Record saved successfully
empid
--------1
2
dept
-------------Dept1
Dept2
designation
-----------S.E
S.SE
Status
--------------------Record saved successfully
Record saved successfully
Now, if you try to create the record which is not in the table emp_personal, which has
the empid = 6. But it'll not allow us to create the record 6, because of the foreign key
relationship between these two tables....
6
Dept6
P.M
Now, the foreign key relationship helps us to avoid the duplicate entry.
Foreign key relationship is possible between the tables having at least one same type
of field. Also, the Technical characteristics of the fields should be same. This is done
in the value table.
This is the concept of Foreign key.
INCLUDE structure:
Both Customizing Include and normal Include are included in a table/structure
using .INCLUDE
Customizing Include : Some SAP Standard tables/structures are delivered with
Customizing/Customer Include which act as container of custom fields.So Customers can
thus enhance tables and structures of the standard system without themselves having to modify
the table and structure definitions.
In contrast to append structures,a Customizing include can be contained in several tables or
structures.
The name of a customizing include begins with 'CI_' and the include is in the customer
namespace.
The fields in customizing includes need to be in customer namespace (YY* / ZZ*) in order to
avoid conflicts with future fields added by SAP to the same table/structure.
Normal Include structure can be used in multiple tables/structures and structure name can begin
with Z* / Y*.