‎2006 Nov 09 8:07 AM
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
‎2006 Nov 09 8:11 AM
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
‎2006 Nov 09 8:33 AM
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.
‎2006 Nov 09 8:43 AM
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.
‎2006 Nov 09 9:33 AM
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
‎2006 Nov 09 8:12 AM
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
‎2006 Dec 08 1:09 AM