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

Foregin Key Problem

Former Member
0 Likes
866

Dear All ,

I have created two tables one is ZEMPTABLE and ZDEPTABLE . The Fields are LIsted Below .

Fileds OF ZEMPTABLE .

EMPID Key

EMPNAME

EMPDEP .

Fields of ZDEPTABLE .

DEPID key

DEPNAME .

I have given same domain for EMPDEP and DEPID . I have used ZDEPTABLE as a check table for ZEMPTABLE . I am very sure about creating foreign key .I have 4 entries in ZDEPTABLE viz : 10 , 20 , 30 and 40 .

As of My understanding when I enter the EMPDEP in ZEMPTABLE through SE11 -> Utilities -> Table Contents -> Create Entries , system should not allow me to enter anything apart from 10 , 20 , 30 and 40 .All tables and releated objects are Active .

Now the problem is EMPDEP field of ZEMPTABLE takes any value and does not check for entries in check table . what may the reason . I am struggling for this from last 2 days . Please let me know if any thing else is required .

I am very much sure about the way which i have followed to create foregin key is right .

Please throw some light on my problem . Thanks in Advance .

7 REPLIES 7
Read only

Former Member
0 Likes
842

Hi

It depends on how these hits are entered.

The control of check table is triggered only in the dynpro, but if you have some programs fill ZEMPTABLE by SQL statament (INSERT or MODIFY), no control of check table can be triggered.

Max

Read only

0 Likes
842

Hello ,

I am etries using standard DYNPRO of se11 but it is not working

Read only

0 Likes
842

Hi

I've defined your tables in my system as you've mentioned and it works fine: so are you sure all links are right?

Max

Read only

0 Likes
842

Hello Max ,

First of all Thank you for you response . I am very much sure what ever problem i have given is very much right and I have done the foreign key creation in same way .

Read only

Former Member
0 Likes
842

When we define foreign key constraint, there will be screen check.. but through SQL stateements we can violate these constraints.

As you said, you have defined the constraing properly than also check the following:-

In table ZEMPTABLE-->

for the field EMPDEP-->in foreign key dialog:-

Under Screen check:-

1. Select the the "Check require" checkbox (without this i guess there will be no screen check.)

2.In semeantics attariburtes:-->select key fields/attibutes radio button and

3. set the cardinality to 1:CN

Read only

Former Member
0 Likes
842

Hi,

Just creating the foreign key will not help u in restricting the values. Go to Table Maintenance Generator and create the Table maintenance for your foreign key table. Now try to enter values and now it will act as you like. If u need step by step infn. then mail me.

U. Uma

Read only

0 Likes
842

Hi Uma!!

I have also faced the same problem mentioned here ,But yeah I did not create any table maintenance generator.So I feel am struggling with the steps I should follow.So can u please send me the deatils of creating foreign key relatioships??

Will be waiting for your help.

Thanks & regards,

Deepa.