Foreign Key
- We can use foreign keys to define relationships between tables in the ABAP Dictionary, create value checks for input fields and link several tables in aview or alock object.
- One of the foreign key fields is marked as the check field. The foreign key relationship is maintained for this field.
- When we make an entry in the check field, the system checks whether the check table contains a record with the key defined by the values in the foreign key fields.
- If there is such a record, the entry is valid. Otherwise the system rejects the entry.
- Check table is a table which will be connected via foreign key relationship.
- Foreign key of Foreign table must match with the primary key of check table.
- Check table is given at field level.it contains only valid values.
Steps
- Go to Transaction code SE11.
- Make ZSD_VBAP table's VBELN field as foreign key and ZSD_VBAK table as Check table.
- Select the VBELN field from ZSD_VBAP.
- Click on foreign Key button.
- Enter the Check table name.
- Click on Generate proposal.
Result
- Create records in ZSD_VBAP Table.
- Utilities -> Table Content -> Create Entries.
- VBELN of Table ZSD_VBAP referrers the value of VBELN of ZSD_VBAP.
- Select any value and create record.
- Other than VBELN value of ZSD_VBAK table , throws error.
No comments:
Post a Comment