1
votes

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.

2
You don't describe the reason for what you're trying to do. Unless I'm missing something, what you're trying to do makes no sense from either a technical nor a business standpoint whatsoever.vwegert
Sorry to say and please don't take this personally - you don't know what you're doing and you're not making any sense at all. Instead of smashing bits and pieces together in a mission-critical ERP system, you should really consider getting the proper training.vwegert

2 Answers

2
votes

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

1
votes

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).