cancel
Showing results for 
Search instead for 
Did you mean: 

Start routine to filter the duplicate records

Former Member
0 Kudos

Dear Experts

I have two questions regarding the start routine.

1) I have a characteristic InfoObject with transactional InfoSource. Often the 'duplicate records' error happens during the data loading. I'm trying to put a start routine in the update rule to filter out the duplicate records.

After searching the SDN forum and SAPHelp, I use the code as:

DELETE ADJACENT DUPLICATES FROM DATA_PACKAGE COMPARING KEY1 KEY2 KEY3.

In my case, the InfoObject has 3 keys: SOURSYSTEM, /BIC/InfoObjectname, OBJVERS. My code is:

DELETE ADJACENT DUPLICATES FROM DATA_PACKAGE COMPARING SOURSYSTEM /BIC/InfoObjectname OBJVERS.

When checking the code I got message: 'E:No component exists with the name "OBJVERS".' So I only included the first 2 keys. But the routine does not work. The duplicate error is still happening. What is missing in this start routine?

2) Generally, for a start routine, do I really need to include the data declaration, ITAB or WA, SELECT statement etc.?

Do I have to use the statement below or just simply one line?

LOOP AT DATA_PACKAGE.

IF DATA_PACKAGE.....

.....

ENDIF.

ENDLOOP.

Thanks for your help in advance, Jessica

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Yes, if you have more than one data package, the issue may still remain the same.

The best thing is clean up the source data and enforce uniqueness of records thereby you get to get rid of the problems at the source. Consider this.

Guess you have non-R/3 data source.

Ravi Thothadri

Answers (3)

Answers (3)

Former Member
0 Kudos

Thanks for your answers. I've transported the update rule with the start routine to production system to see if it works.

Former Member
0 Kudos

Dear all

The code with start routine does not work. We still get 'duplicate records' error.

Ernst

Do you mean before the master data InfoObject, we can add another ODS which has exactly same key fields as the InfoObject? Currently, we have an ODS before the InfoObject which has more key fields than the InfoObject.

Thanks, Jessica

Former Member
0 Kudos

Hello Jessica,

if it won't be possible for you to get unique data from the very beginning, there is still another way to manage this problem in a start routine.

Sort ... and delete adjacent ... must remain. Further on build up an internal table of type data_package, but defined with STATICS instead of DATA. This i-tab stays alive for all data-packages of one load. Fill it with the data of the transferred data-packages, and delete from every new data-package all records which already are in the statics i-tab. Alternatively you could do the same with a Z-(or Y-)database-table instead of the statics i-tab.

It will probably cost some performance, but better slow than wrong data.

Regards,

Ernst

Former Member
0 Kudos

Before doing DELETE ADJACENT you have to sort data with the instruction:

SORT DATA_PACKAGE BY KEY1 KEY2.

Also remeber that if you have more than one dta_package you could also have problem because if you have duplicate records in diffrente datapackage thi will not solve the problem.

Hope it helps.

Regards

Former Member
0 Kudos

Paolo

Do you mean the code should be?

SORT DATA_PACKAGE BY KEY1 KEY2.

DELETE ADJACENT DUPLICATES FROM DATA_PACKAGE COMPARING KEY1 KEY2

Thanks, Jessica