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

DUPLICATE PROCESS

Former Member
0 Likes
651

Hi,All.

I am so sorry that!I asked a question yesterday,but no one completely solved it. still sth wrong with it.

That is:

there are some records in a IT, if they have the same KEY feilds F1 F2, we call them the same records,that is they are duplicate records.

Now I want to remove the duplicate records into another IT_2 except the last duplicate record,and set the status of the dupliate records 'X' in the IT_2.

How to do it.

Thanks

6 REPLIES 6
Read only

Former Member
0 Likes
617

Such as:

IT_1

AA 10 QWE

AA 11 SSD

AA 10 ZXC

AA 10 SDF

BB 33 FGH

BB 33 TYU

after the process, i want to let the records in 2 diffrence IT

one is the original IT_1, it contains:

AA 10 SDF

AA 11 SSD

BB 33 TYU

and another IT_2 it contanis:

AA 10 QWE X

AA 10 ZXC X

BB 33 FGH X

Message was edited by: lei xiang

Read only

0 Likes
617

sort it_1 by f1 f2 (stable).

loop at it_1.

it_2 = it_1.

at new f1.

append it_2.

endat.

endloop.

DELETE ADJACENT DUPLICATES FROM it_1 comparing f1 f2.

Regards.

Ramesh.

Read only

0 Likes
617

earlier one which i posted is wrong xiang...soory..

this is correct one..

loop at it_1.

at new f1.

continue.

endat.

it_2 = it_1.

append it_2.

endloop.

DELETE ADJACENT DUPLICATES FROM it_1 comparing f1 f2.

Regards,

Ramesh.

Read only

0 Likes
617

Hi Lei Xiang,

Add one more field in IT_1 which is use ful to delte the unwanted records from this table after the loop.

IT_1

F1 F2 F3 F4

AA 10 QWE

AA 11 SSD

AA 10 ZXC

AA 10 SDF

BB 33 FGH

BB 33 TYU

sort it_1 by field1 field2.

DATA: W_FLAG(1).

loop at it_1.

  • This flag is use ful to keep only the required entries(last entries in table)

W_FLAG = 'X'.

AT END OF IT_1

Clear w_flag.

endat.

If w_flag = 'X'.

Move correspondingfields of it_1 to it_2.

append it_2.

clear it_2.

it_1-F4 = 'X'.

modify it_1 transporting F4.

endif.

endloop.

delete it_1 where F4 = 'X'.

If it is helpful to u do reqard the points.

Reagrds,

Kiran I

Read only

Former Member
0 Likes
617

sort it by f1 f2 stable.

Loop at it.

at end of f2.

continue.

endat.

it_2 = it.

it_2-status = 'X'.

append it_2.

endloop.

Message was edited by: Tomasz Kozerski

Read only

Former Member
0 Likes
617

YES