Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

regarding foreign key

Former Member
0 Likes
560

hiiii .. can any one clarify wht exactly is generic foreign key,adapted f.key and constant foreign key...

thankxx in advance

bhabani

3 REPLIES 3
Read only

Former Member
0 Likes
522

Refer to these related threads

Read only

Former Member
0 Likes
522
"Generic and Constant Foreign Keys

If you do not want to check against all the key fields of the check table, you can exclude fields of the foreign key table from the assignment of the fields to the check table with 'generic and constant foreign keys.

It is not always advisable to check a foreign key against all the key fields of the check table. This is true for example for time-dependent check tables and for check tables whose version number is a component of the key.

You can use generic foreign keys in these cases. Fields are excluded from the assignment to the key fields of the check table here. The check is only against the remaining key fields.

You can also assign a constant value to a key field of the check table. In this case you only have to check against the specified constant. You can use this check if only records of the check table which contain a constant value in this key field are valid.

The corresponding SELECT statement for the screen check has the following form for the foreign key definition in the graphic:

"Example :

Foreign key table  : FTAB .
Check Table  : PTAB .
Then ,

SELECT * FROM PTAB WHERE PTAB-FIELD1 = FTAB-FIELD6 AND PTAB-FIELD3 = FTAB-FIELD8 AND PTAB-FIELD4 = ‘K’.

An entry is only valid in check field Field6 if a record of check table PTAB exists containing the input value for Field6 in PTAB-Field1, the input value for Field8 in PTAB-Field3 and constant K in PTAB-Field4.

The values entered on the screen for Field7 and Field9 are meaningless when checking against the check table. An entry with Field6 = 1, Field8 = 3 and Field9 = B would not be valid in this case since there is no record with PTAB-Field1 = 1, PTAB-Field3 = 3 and PTAB-Field4 = K in the check table!

Reward points if it is usefull...

Girish

Read only

Former Member
0 Likes
522

hi,

download the

<a href="http://www.sapbrainsonline.com/TUTORIALS/TECHNICAL/dictionary_tutorial.html">Dictionary Complete Guide</a>

and go through Foreigh Key topic

Regards