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: 

Table creating error

Former Member
0 Kudos

Hi All.

I am working on an issue....there is one ztable named as zemp with the following fields:

MANDT MANDT CLNT 3 0 Client

ZNUM ZNUM CHAR 6 0 Employee number

ZDATE ZDATE DATS 8 0

ZROLE ZROLE CHAR 1 0 emp role

ZCLASS ZCLASS CHAR 2 0 emp class

where mandt is the only key field in it and now I am trying to put the data in it, when I put the first entry using sm30

1.

empnum 1

date 08/08/2008

zrole 3

empclass 12

and now when I am trying to enter the second record:

empnum 1

date 08/08/2008

zrole 2

empclass 12

it's giving me the following error:

An entry already exists with the same key

can you please tell me what exactly the problem is..

Thanks,

Rajeev

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Give the value like this,

empnum 1234

date 08/08/2008

zrole 2

empclass 12

empnum 1235

date 08/08/2008

zrole 3

empclass 12

Regards,

Midhun Abraham

Edited by: Midhun Abraham on Oct 5, 2008 3:27 AM

8 REPLIES 8

Former Member
0 Kudos

Hi Rajiv,

The problem is with the KEY field MANDT, as you have mentioned "mandt" as the only key field it is throwing out this error. This is because when you are working on a system, suppose say your clinet number (MANDT) is "800", you are trying to enter second record with the same client, moreover you have made this "mandt" as the key field. This is the cause for your errot.

I think your requirement is to enter different employee data into this table. Now, make mandt & emp no (both of them ) as the key fields and try entering the data.

This should not create any problem.

0 Kudos

Thanks for the reply srinivas. This time I amde enum also as a key field and tries to enter the following records:

empnum 1234

date 08/08/2008

zrole 2

empclass 12

and now when I tried to enter the seod record as :

empnum 1234

date 08/08/2008

zrole 3

empclass 12

I am facing the same problem !!!

Former Member
0 Kudos

Hi,

Make Empname also key field and enter your data.

1.

mandt 200

empnum 1

date 08/08/2008

zrole 3

empclass 12 like this...you dont get any error.

Thanks,

Sree.

Former Member
0 Kudos

Give the value like this,

empnum 1234

date 08/08/2008

zrole 2

empclass 12

empnum 1235

date 08/08/2008

zrole 3

empclass 12

Regards,

Midhun Abraham

Edited by: Midhun Abraham on Oct 5, 2008 3:27 AM

0 Kudos

Hi Midhun.

My problem is in my scenario a employee can have multiple roles .....

0 Kudos

hey ,

tell me the exact field which are the key fields now.

0 Kudos

mandt and empnum are the two key fields !!!

0 Kudos

hey ,when you make the empnum as the key field it will not allow similar enteries ,for example in the key field there should be change so that the values you give.Here you are entering 1234 for the both of the enteries that will not be accepted because repeatation occurs.So check that will you be able to make some other fields as the key field.