cancel
Showing results for 
Search instead for 
Did you mean: 

DTP Error: Duplicate data record detected

Former Member
0 Kudos

Hi experts,

I have a problem with loading data from DataSource to standart DSO.

In DS there are master data attr. which have a key containing id_field.

In End routine I make some operations which multiple lines in result package and fill new date field - defined in DSO ( and also in result_package definition )

I.E.

Result_package before End routine:

__ Id_field ____ attra1 ____ attr_b ...___ attr_x ____ date_field

____1________ a1______ b1_________ x1

____2________ a2______ b2_________ x2

Result_package after End routine:

__ Id_field ____ attra1 ____ attr_b ..___ attr_x ____ date_field

____1________ a1______ b1_________ x1______d1

____2________ a1______ b1_________ x1______d2

____3________ a2______ b2_________ x2______d1

____4________ a2______ b2_________ x2______d2

The date_field (date type) is in a key fields in DSO

When I execute DTP I have an error in section Update to DataStore Object: "Duplicate data record detected "

"During loading, there was a key violation. You tried to save more than one data record with the same semantic key."

As I know the result_package key contains all fields except fields type i, p, f.

In simulate mode (debuging) everything is correct and the status is green.

In DSO I have uncheched checkbox "Unique Data Records"

Any ideas?

Thanks in advance.

MG

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi Maciej,

Every time when you create new record increase a record number. In Result_package this is your key.

Hope it helps.

Regards,

DL

Answers (5)

Answers (5)

Former Member
0 Kudos

Thanks Mansi and Dariusz.

I made counter in loop and I fill a field result_package-record with that counter.

It solved problem.

Best regards.

MG

Edited by: Maciej Garecki on Aug 7, 2009 2:49 PM

Former Member
0 Kudos

HI Maciej

I have a similar problem but in an expert routine- Can you send me the piece of coding that you added to increase the record number and to add the counter in the loop.

I am not very confident with ABAP and I need to sort my problem as soon as possible

thanks in advance

Manu

Former Member
0 Kudos

you need to fill the record number yourself in the routine otherwise the technical key of all the records you generate from the same source record will have the same key and therefor your load will dump on not uniqueness of key

add a counter and fill the field RECORD:

       v_count = v_count + 1.

       RESULT_FIELDS-record = v_count.

gerald_fuller
Explorer
0 Kudos

This message was moderated.

Former Member
0 Kudos

Hi,

In the end routine, try giving

DELETE ADJACENT DUPLICATES FROM RESULT_PACKAGE COMPARING XXX YYY.

Here XXX and YYY are keys so that you can eliminate the extra duplicate record.

Or you can even try giving

SORT itab_XXX BY field1 field2 field3 ASCENDING.

DELETE ADJACENT DUPLICATES FROM itab_XXX COMPARING field1 field2 field3.

this can be given before you loop your internal table (in case you are using internal table and loops) itab_xxx is the internal table.

field1, field2 and field 3 may vary depending on your requirement.

By using the above lines, you can get rid of duplicates coming through the end routine.

Regards

Sunil

Edited by: Sunny84 on Aug 7, 2009 1:13 PM

Former Member
0 Kudos

Hi,

Please check Error DTP. it can show you which records are duplicate. read detail msg in error DTP. If possible delete error DTP data or correct and upload into DSO and then proceed with next upload.

Regards

Sangita

mansi_dandavate
Active Contributor
0 Kudos

Hi,

In the end routine you have a field called record which must be unique...

It is the record number...

SInce you are appending new records it seems this field is duplicated... While filling the result_package you will have to assign record number in this field like 1,2 ,3 and so on...

Then it should work...

Former Member
0 Kudos

You need to check your end routine, it must be thorwing duplicate key. Is there a possibilty of date being blank and same key being passed in...just guessing.

Vikash

Former Member
0 Kudos

Hi Agrawal.

It is not possible that field date being blank.

Thanks for replaying.

MG