2007 Jun 26 12:54 PM
hello,
I have an internal table which has the following data
101 Raju
102 Shyama
103 Rita
103 Rita
104 Usha
I want to delete the duplicate one for 103, Rita. "Delete adjacent duplicates" is deleting both the entries. I want to retain one entry. Please help
Thanks and Regards
Sudha Naik
2007 Jun 26 12:56 PM
Hello,
DO like this.
sort itab by feild1 field2.
<b>delete adjacent duplicates from itab comparing field1 field2</b>.
Vasanth
Hi,
First sort ur Internal table.
then use delete adjacent duplicates from that Internal table comparing Name.
It will comapre the internal table for any table duplicate entry if exits n then delete the one which has a repeatiton.
Regards ,
Asish Dash
2007 Jun 26 12:56 PM
Hello,
DO like this.
sort itab by feild1 field2.
<b>delete adjacent duplicates from itab comparing field1 field2</b>.
Vasanth
2007 Jun 26 12:57 PM
2007 Jun 26 12:58 PM
it will delete only one one entry , pls post ur code
sort itab by field1 field2.
delete adjacent duplicates from itab comparing field1 field2.
Message was edited by:
Chandrasekhar Jagarlamudi
2007 Jun 26 12:58 PM
before using delete, use sort statement.
sort itab by field1 filed2.
delete adjacent duplicates from itab comparing field1 field2.
2007 Jun 26 1:01 PM
Deleting programmatically
Create an exact replica of the int table say itab1 .
itab1[] = itab[] .
loop at itab .
read table itab1 with key f1 = itab-f1
f2 = itab-f2
fn = itab-fn .
if sy-subrc = 0 . " identical entry
delete itab .
endif .
~ Laxmi
Reward all helpful answers
2007 Jun 26 1:01 PM
Hi,
First sort ur Internal table.
then use delete adjacent duplicates from that Internal table comparing Name.
It will comapre the internal table for any table duplicate entry if exits n then delete the one which has a repeatiton.
Regards ,
Asish Dash
2007 Jun 26 1:09 PM
HI,
Loop the itab where name = rita.
Modify itab.
endloop.
Regards,
Nandha
Reward if it helps
2007 Jun 26 1:38 PM
Hi,
Try with this code:
data: begin of line,
col1 type i,
col2(5) type c,
end of line.
data: itab like standard table of line.
line-col1 = 101. line-col2 = 'Raju'. append line to itab.
line-col1 = 102. line-col2 = 'Shyama'. append line to itab.
line-col1 = 103. line-col2 = 'Rita'. append line to itab.
line-col1 = 103. line-col2 = 'Rita'. append line to itab.
line-col1 = 104. line-col2 = 'Usha'. append line to itab.
write 'Before delete'.
loop at itab into line.
write: / line-col1, line-col2.
endloop.
write:/ 'After delete'.
delete adjacent duplicates from itab.
loop at itab into line.
write: / line-col1, line-col2.
endloop.
Regards,
Bhaskar
2007 Jun 26 1:47 PM
2007 Jun 26 1:51 PM
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |