‎2007 Sep 02 12:42 PM
hallow
i wont to delete appearance in table of mine when data appear more then one time
example
itab before
<b>field num</b>
100 aa
100 bb
200 cc
200 dd
itab after
<b>field num</b>
100 aa
200 cc
<b>i reward</b>
regars
i try with
DELETE ADJACENT DUPLICATES FROM itab
but its not working
Regards
‎2007 Sep 02 1:05 PM
Check the below program :
data : begin of itab occurs 0,
num(3) type n,
fld(4) type c,
end of itab.
start-of-selection.
itab-num = '100'.
itab-fld = 'aa'.
append itab.
itab-num = '100'.
itab-fld = 'bb'.
append itab.
itab-num = '200'.
itab-fld = 'cc'.
append itab.
itab-num = '200'.
itab-fld = 'dd'.
append itab.
DELETE ADJACENT DUPLICATES FROM itab comparing num.
loop at itab.
write:/ itab-num,itab-fld.
endloop.
Thanks
Seshu
‎2007 Sep 02 1:03 PM
sort itab by field num .
delete adjacent duplicates from itab comparing field.
‎2007 Sep 02 1:05 PM
Check the below program :
data : begin of itab occurs 0,
num(3) type n,
fld(4) type c,
end of itab.
start-of-selection.
itab-num = '100'.
itab-fld = 'aa'.
append itab.
itab-num = '100'.
itab-fld = 'bb'.
append itab.
itab-num = '200'.
itab-fld = 'cc'.
append itab.
itab-num = '200'.
itab-fld = 'dd'.
append itab.
DELETE ADJACENT DUPLICATES FROM itab comparing num.
loop at itab.
write:/ itab-num,itab-fld.
endloop.
Thanks
Seshu
‎2007 Sep 02 1:11 PM
Small modification in code and i forgot to keep sort command.
Check the below program :
data : begin of itab occurs 0,
num(3) type n,
fld(4) type c,
end of itab.
start-of-selection.
itab-num = '100'.
itab-fld = 'aa'.
append itab.
itab-num = '100'.
itab-fld = 'bb'.
append itab.
itab-num = '200'.
itab-fld = 'cc'.
append itab.
itab-num = '200'.
itab-fld = 'dd'.
append itab.
<b>sort itab by num fld.</b>
DELETE ADJACENT DUPLICATES FROM itab comparing num.
loop at itab.
write:/ itab-num,itab-fld.
endloop.
Thanks
Seshu