Application Development 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: 

Issue in establishing relationship in Help View!!!

0 Kudos

Hello,

In Help View, I have two tables ZEMP_691611 and ZPROJ_691611.

employee table(check table) contains fields mandt, empid, empname where empid is primary key

and project table(foreign key) contains mandt, empid, projid, projname where empid is the foreign key.

I can establish relationship between project table and employee table which are foreign key and check table respectively.

But in the reverse situation i.e. when i am trying to establish a relation between employee table and project table facing an issue with unsuitable cardinality.

In a contradictory example, I have two table T416 and T416t. T416 corresponds to Employee table here and T416t to Project table. But I can join the T416 with T416t table with no issue of cardinality.

Please suggest something.

8 REPLIES 8

horst_keller
Product and Topic Expert
Product and Topic Expert

From the dictionary reference documentation:

  • The secondary tables must have an N:1 dependency on the primary table or on the transitively preceding secondary table. This makes sure that no more than one dependent data record exists in each of the secondary tables for a specific data record in the primary table. An N:1 dependency exists if the secondary table is the check table in the foreign key in question.
  • If the secondary table is the foreign key table, the foreign key fields must be key fields of a table or the foreign key must have the cardinality N:1 or N:C.

0 Kudos

Thanks for the explanation but I couldn't understand much of it as the same kind of info already available on internet.

Please be specific with the example asked in the above question.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

In one of your screen shots I see a foreign key cardinality that contradicts the documentation. Maybe that's the reason.

former_member228164
Participant

The cardinality (n:m) describes the foreign key relationship with regard to the number of possible dependent records (records of the foreign key table) or referenced records (records of the check table).

The left side (n) of the cardinality is defined as follows:

  • n=1

    There is exactly one record assigned to the check table for each record of the foreign key table.

  • n=C

    The foreign key table can contain records that do not correspond to any record of the check table because the foreign key field is empty. This can occur, for example, if the field of the foreign key table is optional, in which case it does not have to be filled.

The right side (m) of the cardinality is defined as follows:

  • m=1

    There is exactly one dependent record (record of the foreign key table) for each record of the check table.

  • m=C

    There is at most one dependent record for each record of the check table.

  • m=N

    There is at least one dependent record for each record of the check table.

  • m=CN

    There can be any number of dependent records for each record of the check table.

0 Kudos

Here is the link where the above can be found in the documentation

http://help.sap.com/abapdocu_751/en/index.htm?file=abenddic_database_tables_forkey.htm

0 Kudos

Cardinality is defined during foreign key relationship.

The cardinality of the foreign key relationship describes, for each value in the check table, how many rows of data are
allowed to be in the foreign key table.
Cardinality is defined as X:Y, where X refers to the check table and Y refers to the foreign key table.

X can have only values 1 or C and Y can be 1,C,N or CN.
1,C,N,CN has specific descriptions.
cardinality is not enforced by the system.It is optional. Hope you get my point.

horst_keller
Product and Topic Expert
Product and Topic Expert
0 Kudos

cardinality is not enforced by the system.It is optional.

With the exception of maintenance and help views, where cardinality counts ...


0 Kudos

Sorry sir i didnt get your question.....For Foreign Key relationship only Cardinalty exists.