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

DATA DICTIONARY

Former Member
0 Likes
1,089

Hi gurus,

I've created one z table based on the output fields in a report.The report contains 14 fields and i've taken those 14 fields in my z table... the output of the report contains repeated values in many coloumns. but i've to update that in my z table. the problem is i've taken two key fields they r mandt and posid. the posid contains repeated values in the report and all the duplicates must be stored in the z table i've created. but the table is not accepting the duplicates in the table.. what i should do... can anyone help me with this???

Thanks in advance.

1 ACCEPTED SOLUTION
Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,036

First remember primary key is a constraint : unique key and not null values.

So you must provide different values of primary keys to store multiple records :

- either find another existing field which provides uniqueness, and add it to primary key

- build a technical counter to provide uniqueness like a range number, either add it to current primary key, or build a new primary key mandt+counter, and create an index on current primary key.

In either case, you will then have to delete previous records yourself when you will be requiered to update and not insert into the database.

Regards,

Raymond

10 REPLIES 10
Read only

Azeemquadri
Contributor
0 Likes
1,036

In your ztable make more fields part of the key.

Make sure the fields that you choose in the ztable form a unique row each time.

example : MANDT POSID ZFLD1 ZFLD2

If you consider these 4 fields together they should be unique for each row.

Read only

Former Member
0 Likes
1,036

You can't have non-unique table keys. You either have to add more fields to the key so as to make each key unique or assign a separate field that you can increment sequentially as the key. Look at transaction SNRO and it's documentation.

Read only

Former Member
0 Likes
1,036

Hi,

In your case you cannot take posid as the primary key. Is there any field amongst the 14 fields that is unique? If yes, choose that as the primary key.

Regards

Purnand

Read only

0 Likes
1,036

i don't have any unique field except one date.... everything has repeatitions...

Read only

0 Likes
1,036

Hi,

I don't know what is the requirement of creating a customized table in you r company. There is no harm in taking date as the primary key. Again it all depends upon the requirement.

If you think that date will never be repeated, you can take the date as the primary key.

Regards

Purnand

Read only

Former Member
0 Likes
1,036

Hi Enoch,

Please use this syntax at the end of your INSERT statement and it will accept duplicate keys:

'ACCEPTING DUPLICATE KEYS'. You can do an F1 also on this. This will help your requirement.

Read only

Former Member
0 Likes
1,036

Take more than 2 Primary keys.it will solve ur issue.

Thanks

Tarak

Read only

Former Member
0 Likes
1,036

Hi,

In your case you can also add one more field as 's.no' which can be unique and then you can remove posid from the key field.This can solvew your problem.The other solution,as specified by others,is to take a group of fields as a key field.Only these are the possibilities available.

Hope it solves your problem,

Thanks,

Nitin

Read only

Former Member
0 Likes
1,036

hi

if only set mandt as key field,z table can store  repeated  value .

thanks

vincent

Read only

RaymondGiuseppi
Active Contributor
0 Likes
1,037

First remember primary key is a constraint : unique key and not null values.

So you must provide different values of primary keys to store multiple records :

- either find another existing field which provides uniqueness, and add it to primary key

- build a technical counter to provide uniqueness like a range number, either add it to current primary key, or build a new primary key mandt+counter, and create an index on current primary key.

In either case, you will then have to delete previous records yourself when you will be requiered to update and not insert into the database.

Regards,

Raymond