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: 

Data entry in the table

Former Member
0 Kudos

Hi All,

I havae a scenario..

I have one ztable with the foloowing fields:

1. enum

2. Ecnum

3. Add

4. Date

5. erole

what I did is I made enum and ecnum fields as the key fields in the table and rest I didn't make as key fields. Now when I tried to enter data in this table using sm30....I am facing a problem...I tried putting the following record:

1st rec.

123

012

xyz

010101

1

2nd record.

321

011

abc

020202

1

Now as soon as I enter the second record it says the record is already there..

so can you tell me what's the problem...I mean I didn't make erole as the key field but then also I ma having this error...

Thanks,

Rajeev

Edited by: Rajeev Gupta on Oct 3, 2008 4:09 PM

7 REPLIES 7

Former Member
0 Kudos

Did you check in the table if the entry is already present with the keys of the second record ?

regards,

Advait

0 Kudos

Hi Advait,

Thanks for the reply...

Yes I did check the table just has one record i.e. my first record and now I am trying to enter the second one and I am getting this error.....do you also how can I make a field unique...that will not allow two records to have the same value in one field.

0 Kudos

Hi,

Did you check if both the fields are marked as key fields ?

Regarding :

do you also how can I make a field unique...that will not allow two records to have the same value in one field.

As per the principles of DBMS, you should define only 1 key field in the table. Otherwise there is no point in having 2 fields as key fields.

regards,

Advait

0 Kudos

>

> As per the principles of DBMS, you should define only 1 key field in the table. Otherwise there is no point in having 2 fields as key fields.

Huh?

Rob

0 Kudos

Hi Rob,

I did not mean that you should always define 1 key field in the table always

I was refering to the scenario he wants to create.

i.e the key field should not be repeated for another entry even if there are 2 key fields in the table.

It's is possible to achieve this with table maintenance modification events, But I guess the best way to restrict this would be to only define one key field for the table.

regards,

Advait

0 Kudos

Well, I'm still not sure I understand (but it may be because I really don't understand the original question.

If you look at table BSIS, the first key of the index is BUKRS. It's also the first key of the index BSIS~1.

Rob

Former Member
0 Kudos

Check again the table definition and see if both key and initial value checkboxes are active on both.

Also, don't forget to include mandt, otherwise you are making the able be universally accessible, and not dependant on the enviroment you are working on.