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: 

Primary key SE11

Former Member
0 Kudos
869

Hi everyone,

i created a table with 2 columns( character(1));

i like to have first column unique and also the second column.

First column should accept only the unique entries ,Even the second column

A A

B B

<b>A</b> C . this combination should not be allowed. because A is repeated in column 1.

C <b>B </b>. this shouldnt be allowed as column 2 needs column 2 unique.

Ur help is appreciated

1 ACCEPTED SOLUTION

Former Member
0 Kudos
185

Hi ,

here u can check at time of entering records in table.U can here a event which checks if the field is uniue through table maintainence generator.

Utilities -> Table Maintainence Generator in that

Environment ->Modifications-> Events

Here u can write code in events which check if its unique..

Reward points if helpful.

6 REPLIES 6

Former Member
0 Kudos
185

Hi M B,

In the Table You have to mention these two fields should be as a key field then it won't allow to enter the data as you mentioned.

Hope it will help u.

madan.k

0 Kudos
185

Hi,

I dont think this can be achevied in one TABLE, you might need to break this into two tables and a third table can be created and have a combined key with each field having foriegn key relation with the parents tables. Create one table with one field as KEY and another table as another filed as KEY then create a third table with both the fieldsand then create foriegn key for each field with the parent tables.

Regards,

Sesh

Former Member
0 Kudos
185

Hi ,

I think even if you declare the two columns as primary keys your scenarion of having unique keys will work , you can try maintaining such data to test via se16.

Regards,

Sunmit.

Former Member
0 Kudos
186

Hi ,

here u can check at time of entering records in table.U can here a event which checks if the field is uniue through table maintainence generator.

Utilities -> Table Maintainence Generator in that

Environment ->Modifications-> Events

Here u can write code in events which check if its unique..

Reward points if helpful.

0 Kudos
185

Thank u siddhi...

could u pls clearly state the procedure...

The option u mentioned is grayed out.

MB

0 Kudos
185

Hi MB,

You will have to enter the authorization group, function group (u can create a new function grp ) , maintence type - one step. overview screen (u should write screen number ).

then the events option will be enabled.

Siddhi