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

Foreign KEy

lijisusan_mathews
Active Contributor
0 Likes
832

HI,

I have a master table and a slave/client table.. in the client table , a non-key field refers to a primary key in the master table. i e. it shud only have values which exist in the master table. This is achieved by setting the foreign key.. But , now.. after filling a record in the client table, i am able to delete that particular record from the master table.. And the corresponding record in the client table continues to exist without error.. Is there a way to prevent the deleting of master records when client records exist..?? or to delete the client records from all tables..??

Suzie.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
787

How did you set the cardinality while defining the check table ?

regards,

Advait

6 REPLIES 6
Read only

Former Member
0 Likes
788

How did you set the cardinality while defining the check table ?

regards,

Advait

Read only

0 Likes
787

I tried with all different options of cardinality.. nothing helps to stop the deleting of master record, but it checks the value when inserted into the client table.. But it still dosnt stop the master record from being deleted

Suzie

Read only

0 Likes
787

Guess you will have to handle this in your program by checking records in the master/client table depending on which table you are deleting from.

regards,

Advait

Read only

0 Likes
787

Thats how I have done it. I wanted to be sure there wasnt any other simpler option, as this is possible in most other languages..

i guess theres no other option. i also heard that this feature is not included in SAP, as it conflicts with some requiremnst in some modules.

So thanx all. ai am closing this topic

Edited by: Suzie on Jan 7, 2009 2:26 PM

Read only

Former Member
0 Likes
787

HI,

Foreign keys are checked by the user interface only..i.e in a screen when you press enter key,function key ,pushbutton or menu item is selected..They do not exist in the database and hence not checked when you just update data directly ..

Regards

Vasavi

Read only

0 Likes
787

But it shud work when I am trying to do it in ABAP dictionary right?

And even in screens, I am using a table control , i need to use internal tables, and in that case, i cannot check the 'Foreign key' check box.. So its no use..

Suzie