Question

Simply put, i want to create a structure that has a component MAKTX, and to have a foreign key relation with MAKT-MAKTX. More generally i want to have a foreign key check for a field that's not part of a primary key.

I see the button "Non-key-fields/candidates", but i don't really know how to use it.

Also, i don't want to use the "key fields of a text table" relation... but i don't know if that's relevant.

Is this even a good thing that i'm trying to do? I don't see any reason why it shouldn't be possible, but you might object.

[EDIT]: I have to mention that I don't really know what I'm doing. I really just want to fill a table i created with values from another, and to make sure that those values (namely MAKTX - kind ofvalues) in my table are always values from MAKT. Suppose i do the initial filling with a SELECT statement, i want the consistency to work even if i later insert new entries manually. So I don't know whether this makes sense or not, it just sounds to me like a good idea to have the system perform this check automatically, if possible.

Was it helpful?

Solution

First off, I agree with vwegerts's comments, what you're trying to do doesn't seem to make any sense.

Perhaps this would make more sense: create your own table without the MAKTX field. Then create a database view, joining your table and the MAKT table (and set a default language in the selection conditions if you want to). This way you'll have the descriptions joined with your data, without duplicating the actual data (which is what it looks like you're trying to do).

OTHER TIPS

Main condition for creating foreign key relation is that the field should be a primary key in your reference table. While in the table you are creating foreign key its not necessary that the field is a primary key or not. The main reason for this is that foreign key cant be null.

Refer to below link for step by step process for creating foreign key relation in abap.

http://learnabaponline.blogspot.in/2013/04/how-to-create-table-in-abap.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top