Application Development and Automation 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: 
Read only

database table

Former Member
0 Likes
909

Hi all,

I have created a database table with the following fields

1) mandt

2) matnr

3) werks

4) lgort

5) length - used my own datatype

6) erfme

7) erfmg

i have mandt as primary field.

now after inserting the first record while i am trying to insert a new one, it always gives me the same message however i change the data.

it says A DATA RECORD WITH THE SPECIFIED KEY ALREADY EXISTS.

plz help me out on this.

Thanks and Regards,

C.A

1 ACCEPTED SOLUTION
Read only

bpawanchand
Active Contributor
0 Likes
882

Hi

MANDT is the client login number so when ever you try to insert another record with the same primary key it triggers an error.

you should define along with MANDT one more fields as primary KEY

Regards

pavan

9 REPLIES 9
Read only

Former Member
0 Likes
882

> i have mandt as primary field.

what about other key fields will that table in active state.

If you enter duplicate keys then it will not allow you to create the entries.

Read only

0 Likes
882

Hi Vijay,

I have only mandt as primary field.

Regards,

C.A

Read only

0 Likes
882

Hello

For correct work it is necessary to do several primary fields.

For example - mandt + matnr + werks

Read only

0 Likes
882

If you have one primary key that is mandt then how can you insert the other records.

include other key/s and it will allow you to create multiple entries, until unless you don't have any duplicates.

Read only

bpawanchand
Active Contributor
0 Likes
883

Hi

MANDT is the client login number so when ever you try to insert another record with the same primary key it triggers an error.

you should define along with MANDT one more fields as primary KEY

Regards

pavan

Read only

Former Member
0 Likes
882

The thing is you have specified only MANDT as primary key. So, it always holds only record and so it gives the message.

You need to specify more fields as key fields. May be MATNR and WERKS also make them as primary keys...

In this way you can insert more records...

Read only

Former Member
0 Likes
882

Hi,

In the Database table you have mentioned MANDT as primary key.

But Mandt by default filled as the logon client number.

So again if you insert new records it will take same client no but in Database table it is not possible. Thats why it is showing the error.

Better you add one more primary key except MANDT then there will be no problem.

Regards,

Sujit

Read only

Former Member
0 Likes
882

Hi,

When you used only MANDT as key field

it will not allow to enter the records more than 1

Because the table checks the entries against key fields in the table

So it looks for mandt in your case. but the record will be in the table already

So you need to create one more key field based on your requirement.

Regards,

Siva Chalasani

Read only

Former Member
0 Likes
882

along wiht MANDT, you should set the 2) matnr

3) werks

fields also key fields. then it consider the combination of these three fields is unique.