07-04-2007 8:26 AM
I have a Z table having these fields....
MANDT MANDT
GSBER GSBER (primary key also)
HBKID HBKID
Foreign key is defined for GSBER (taken from TGSB table)
Check table is defined both for GSBER and HBKID..
i have created a table maintainence generator also..
my Requirement is that... When i am entering value in the table...
for One value of GSBER there can be only one value of HBKID
basically a 1 is to 1 relationship...
i wil give an example..
GSBER HBKID
120 555 ( Right)
120 545 (not Allowed)
343 555 (not allowed)
ps: I have tried making the HBKID also as primary key... but then it is accepting values which are null. so i dont think thts right...
How can i use cardinality in this case.... If that is the solution?
thanks
Ankit
07-04-2007 9:38 AM
Hi Ankit,
1> Make the field GSBER as mandatory in overview and single screen in table maintainance->double click the screen numbers->element list->special attr.->make input as required so that <b>null value</b> won't be accepted.
2> Create a event in table maintainance ( <b>creating a new entries</b> )
3> write an select query to check whether this value already exist in table in the fields GSBER, HBKID.
SELECT GSBER HBKID INTO WS_ZTABLE
FROM ZTABLE
WHERE GSBER EQ ZTABLE-GSBER OR
HBKID EQ ZTABLE-HBKID.
4> IF any values found then display 'error message'
else accept the entries.
I think this will solve ur problem
Regards,
Nithya
07-04-2007 10:33 AM
create table with 3 fields as you are .
<b>MANDT MANDT
GSBER GSBER (primary key )
HBKID HBKID</b>
Only Gsber is primray key ...
no check table for both fields ...
now try it
it will give as
<b>
GSBER HBKID
120 555 ( Right)
120 545 (not Allowed)
343 555 (Right)
343 545 (not Allowed)</b>
reward points if it is usefull ....
Girish