Deleting records from an Itab RESOLVED

Question: SORT then AT END OF copy record out... perhaps?


_________________
The Doc
Magna Grand Docot of the Tuly Idiot Order

2007 Basic Rules

Answer:
OBJNR BELNR OTHER FIELDS >>>>>>
1111 0001
1111 0002
1111 0003
2222 0001
2222 0002
2222 0003
3333 0001
3333 0002
3333 0003

What you need to do is "SORT ITAB BY OBJNR BELNR DESCENDING.
Your table now will look like:
OBJNR BELNR OTHER FIELDS >>>>>>
1111 0003
1111 0002
1111 0001
2222 0003
2222 0002
2222 0001
3333 0003
3333 0002
3333 0001

DELETE ADJACENT DUPLICATES FROM ITAB COMPARING OBJNR.
This will delete Record 2 and 3 when OBJNR = 1111, 2222 etc.

Output:
OBJNR BELNR OTHER FIELDS >>>>>>
1111 0003
2222 0003
3333 0003

This is the easiest/cheapest way to do.

Rajesh

Answer:
Nice one! That's the answer. I've just used the AT END solution, moving records from one table to another, but this last idea is better. I'll use it.

Thanks,
Chris.

Answer:
Chris,
You can use AT END OF...but it will get expense if the size of the ITAB is large (if you are dealing with millions of records). You have to spin through each record to get the record you want.

-Rajesh
Copyright ?2007 - 2008 www.jt77.com