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

Help!!! insert records in Ztable same primary key

Former Member
0 Likes
1,410

Hi

I need a big help, I'm trying to insert 3 rows into ZTABLE with same keys (MANDT,FILENAME) but it's not possible, this is code line:

    INSERT ZTABLE FROM TABLE IT_ZTABLE ACCEPTING DUPLICATE KEYS.

How can I do?

Thanks in advance, It's URGENT

Regards,

Tokio.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
1,060

Insert command will work like only new records..

if you have new records then it will insert on depends on primary key.

modify command will work both insert and update..

you can not insert primary key as duplicates..

Hi

I need a big help, I'm trying to insert 3 rows into ZTABLE with same keys (MANDT,FILENAME) but it's not possible, this is code line:

    INSERT ZTABLE FROM TABLE IT_ZTABLE ACCEPTING DUPLICATE KEYS.

How can I do?

Thanks in advance, It's URGENT

Regards,

Tokio.

6 REPLIES 6
Read only

Former Member
0 Likes
1,060

Create another key field (SEQNO). Increase this by one for each file.

Rob

Read only

0 Likes
1,060

Rob

I put a field table (zdate) as key field, but I can't insert rows.

Tokio

Read only

0 Likes
1,060

Do it the way I suggested.

When you specify ACCEPTING DUPLICATE KEYS, it won't create new rows with duplicate keys; it just over-wrties the existing record. One way or another, you have to make sure the primary key is unique.

Rob

Message was edited by:

Rob Burbank

Read only

Former Member
0 Likes
1,061

Insert command will work like only new records..

if you have new records then it will insert on depends on primary key.

modify command will work both insert and update..

you can not insert primary key as duplicates..

Read only

Former Member
0 Likes
1,060

Use like this and then it works in normal way

create table like

mandt Primary key

Plant Primary key

date Primar key

count primary key ( you can count these values )

and other fields ( Non Primary key )..

Client Plant Request.dlv.dt count

300 1000 05/17/2007 001

300 1000 05/17/2007 002

300 1000 05/17/2007 900

300 1000 05/17/2007 901

300 1000 05/17/2007 902

300 1000 05/17/2007 903

300 1000 05/17/2007 904

300 1000 05/17/2007 905

300 1000 05/17/2007 906

300 1000 05/17/2007 907

300 1000 05/17/2007 908

300 1000 05/17/2007 909

300 1000 05/17/2007 910

300 1000 05/17/2007 911

300 1000 05/17/2007 912

Read only

Former Member
0 Likes
1,060

Thanks to all of you!!!