Application Development Blog Posts
Learn and share on deeper, cross technology development topics such as integration and connectivity, automation, cloud extensibility, developing at scale, and security.
cancel
Showing results for 
Search instead for 
Did you mean: 
ksuman2000
Explorer
Introduction: In this article we are going to learn how to provide the one to many ( 1 = CN ) cardinality between the check table and foreign key tables. one to many carnality can be selected upon our requirement while providing the foreign key relationship from key fields of foreign key table to check table key fields . One to many ( 1 = CN) cardinality refers there can be any number of matching records in the foreign key table for each record of the check table.

Below are the steps to maintain the one to many ( 1 = CN ) cardinality between the check table and foreign key table.

Check table is the master data table with unique key field value records.

Foreign key table is the dependent table where each record is checked against the check table key fields with which foreign key relationship has been maintained with appropriate cardinality.

Step1: Create a database table ZMASTER using tcode SE11 with the below fields NUM, NAME and AGE fields and maintain the NUM as the keyfield.



Step2: Select the Data Browser/Table View Maint. value as Display/Maintenance Allowed under Delivery and Maintenance tab.



Step3: Maintain the proper values under the Technical Settings.



Step4: Create the entries by going through the Utilities ->Table Contents -> Create Entries



Step5: Enter the record and click on Save button.



Step6: Now the ZMASTER table having only one record as shown below.



Step7: Now create another table ZFOREIGN using tcode SE11 with the following fields NUM and VILLAGE with NUM field as the key field.







Step8: Now maintain the foreign key relationship between ZFOREIGN and ZMASTER. We can achive this by giving  ZMASTER table in Check table field and click on 'Generate Proposal' button. Select 'Foreign key field type' as Key fields/Candidates and cardinality as 1 : CN then click on Copy button as below.



Step9: Now make the VILLAGE field also as key field and activate the table. so the fields NUM and field VILLAGE is the key for table ZFOREIGN.



Step10: Now create the entry in ZFOREIGN table by going through Utilities ->Table Contents ->Create Entries.



Step11: Now create the entries with key NUM and VILLAGE in table ZFOREIGN as shown below.





Step12: The records in the ZFOREIGN as shown below.



Conclusion: From the above example it is clear that ZMASTER is working as check table for the foreign key table ZFOREIGN for field NUM and we can enter many records with various field VILLAGE values for the same field NUM value in table ZFOREIGN. Here the key of table ZFOREIGN is combination of NUM and VILLAGE fields. So we have achieved one to many (1=CN) cardinality.
2 Comments