‎2007 Jul 26 2:02 PM
Hi All,
I am having an internal table with several entries,
now lets say i have 200 entries then there are 10 each of same keys,
so i want to delete the 9 entries and keep only which has higest date,
so technically i want to reduce 200 to 20 entires, can someone suggest some efficient way of doing that please?
thanks,
Hitesh
‎2007 Jul 26 2:08 PM
Hi,
Sort the internal table by date descending & use DELETE ADJECENT DUPLICATES statement.
Or
First sort the table with main key & the date. e.g.:
SORT itab by vbeln ASCENDING date DESCENDING.
Now loop the table & use coantrol break At new VBELN. And append the values to another internal table at new sales order.
at last use the following to assing the contenets of the 2nd internal table to main internal table.
ITAB1[] = ITAB2[].
Reward points if helpful answer.
Ashvender
‎2007 Jul 26 2:06 PM
hi,
sort our internal table by date field as
SORT ITAB BY DATE.
and use DELETE ADJACENT KEYWORD to delete duplicate records as
DELETE ADJACENT DUPLICATES FROM ITAB..............
if helpful reward some points.
with regards,
Suresh Aluri.
‎2007 Jul 26 2:06 PM
you can:
sort tha table for data
delete adjacent duplicates from table comparing keys.
Message was edited by:
Ierardi Leo
‎2007 Jul 26 2:07 PM
Hi,
Let sat ITAB is ur Internal Table with 200 entries.
<b>SORT ITAB BY <Key Fields> <Date field> DESCENDING.</b>
<b>DELETE ADJACENT DUPLICATE ENTRIES FROM ITAB COMPARING <Key Fields> .</b>
Regards,
Ranjit Thakur.
<b>Please Mark The Helpful Answer.</b>
‎2007 Jul 26 2:08 PM
Hi,
Sort the internal table by date descending & use DELETE ADJECENT DUPLICATES statement.
Or
First sort the table with main key & the date. e.g.:
SORT itab by vbeln ASCENDING date DESCENDING.
Now loop the table & use coantrol break At new VBELN. And append the values to another internal table at new sales order.
at last use the following to assing the contenets of the 2nd internal table to main internal table.
ITAB1[] = ITAB2[].
Reward points if helpful answer.
Ashvender
‎2007 Jul 26 2:26 PM
Hi,
Do it like this
<b>Sort itab by date descending.</b>
<b>Delete adjacent duplicates from itab comparing date.</b>
It wll delete all the adjacent duplicate entries by checking date.
I think it will solve your problem.
Award points if use ful.
Regards,
Kishore