Skip to Content
author's profile photo Former Member
Former Member

problem with foreign key relation

i created two ztables ...

maintaned foreign key relation for one field.but if i insert some entries other than the entries in check table it is taking those entries. there is no error message....pls explain.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

5 Answers

  • Best Answer
    author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2008 at 11:36 AM
    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2008 at 11:39 AM

    Hi,

    1. Foreign key relation ships,

    in SAP abap,

    allow to BYPASS IT.

    2. They are just meant

    for showing master list

    in ABAP Module pool.

    3. It won't DO ANY CHECK

    while directly entering in table.

    Regards,

    Omkar.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 04, 2008 at 02:28 PM

    Hi,

    I just created 2 tables for your reqt and tested .its working fine.

    I have created ZEMP table with fields

    empno --> char 4 --> Pkey

    ename --> char20 --> not pkey

    deptno --> char2 --> not pkey

    i created 1 more table ZDEPT table with fields

    deptno --> char2 --> pkey

    dname --> char15 --> not pkey

    Maintain technical settings for 2 tables like

    Data class: Appl0,

    size category: 0

    and activate both the tables.

    In each table atleast 1 field should be pkey.otherwise u will get error that you can see in activation log when you do activation.

    Maintaining foreign key relation ship:

    goto ZEMP table and place cursor on deptno and press Foreign key button (after newrows 1 button is there na that button ).

    then enter ZDEPT in the place of check table text box ,short text and press "Generate proposal" button.

    you will get proposal and just press " Copy " button or enter button.no need to enter other values in this screen if not required specifically.

    Testing:::::::::::

    Now maintain table maitenance generator using

    Utilities ->TMG ->enter auth grp as &NC&.

    and go back and again goto

    utilities-->Table contents->create entries.

    now you give some values.

    you will get error there itself.because you didnt maintain entries in ZDEPT table as it is check table ZEMp table.

    Regds

    Sivaparvathi

    Please dont forget to reward points if helpfull

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member Former Member

      Hi,

      you want to check the field deptno in dep Table while entering values in Field deptno of other Table.

      so that it won't alow the duplicate values. Right?

      But validations are not possible at table level. that's why when ur entering the deptno diffrent from actual no also, it is storing in the database.(it will not check the value in the dept table).

      validations can be defined at the application. we can

      validate the screen field(Ex:deptno) before entering value into the database table.

      we have to write a small code for that.

      If u want to do ..

      1. U must have defined DOMAIN

      thru se11.

      2. In that there is one TAB (Value Range)

      3. At the bottom most,

      There is a VALUE TABLE.

      4. In that Enter the MASTER Table.

      Regards,

      Omkar.

  • author's profile photo Former Member
    Former Member
    Posted on Jan 07, 2008 at 08:53 AM

    Hi

    Instead of just giving the check table fields, just generate a proposal and then activate the table. I guess this will work for u. Also check if u have given the messsage class number correctly.

    with regards,

    hema.

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jan 07, 2008 at 09:27 AM

    create a table maintenance generator path is utilities--> table maintenance generator. and then maintain the values using sm30. u will have a reference check

    awrd if helpful

    Edited by: prasanth kasturi on Jan 7, 2008 10:27 AM

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.