2006 Dec 08 9:21 AM
Dear gurus,
I have a table like this
id counter text
001 001 AAA
001 002 BBB
002 001 AAA
002 002 BBB
002 003 CCC
I want to have a o/p like this
001 002 BBB
002 003 CCC
it it should fetch the latest counter of the id text
please help me out regards this query
thank in advance
Senthil
2006 Dec 08 9:37 AM
sort itab by id counter descending.
loop at itab.
at new itab.
read table itab index sy-tabix.
move-corresponding itab to itab1. " Declare itab1 same as itab
append itab1.
endat.
endloop.
thanx for all u r replies
senthil
2006 Dec 08 9:23 AM
2006 Dec 08 9:26 AM
Hi Senthil,
You can do two ways.
One is
AT END OF id
ENDAT.Other is
Sort itab by text decending.
delete adjacent duplicates itab comparing id.
Regards
Bhupal Reddy
2006 Dec 08 9:29 AM
hi..
u must use the following command in order to delete the repeated values:
<b> delete adjacent duplicates</b>.
try out this command in ur code..
all the best
2006 Dec 08 9:30 AM
sort itab by id.
itab1[] = itab[].
delete adjacent duplicates from itab comparing id.
loop at itab.
loop at itab1 into itab3 whre id = itab-id.
append itab3.
endloop.
sort itab3 by id descending.
move itab3 to out.
append out.
refresh: itab3.
endloop.
2006 Dec 08 9:30 AM
sort itab by id.
itab1[] = itab[].
delete adjacent duplicates from itab comparing id.
loop at itab.
loop at itab1 into itab3 whre id = itab-id.
append itab3.
endloop.
sort itab3 by id descending.
read table itab3 index 1.
move itab3 to out.
append out.
refresh: itab3.
endloop.
2006 Dec 08 9:31 AM
Hi Senthil ,
The code woule be like this
Data : wa_1 like line of it_1.
sort it_1 by id counter descending .
Loop at it_1.
wa_1 = it_1. " Please dont forget to do this
at new id
write: / it_1-id , wa_1-counter , WA_1-TEXT.
endat.
ENDLOOP
Regards
Arun
Message was edited by:
Arun Ramachandran
2006 Dec 08 9:37 AM
sort itab by id counter descending.
loop at itab.
at new itab.
read table itab index sy-tabix.
move-corresponding itab to itab1. " Declare itab1 same as itab
append itab1.
endat.
endloop.
2006 Dec 08 10:56 AM
| User | Count |
|---|---|
| 6 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |