‎2008 May 26 8:32 PM
Hi,
i have the following internal table :
Matnr werks lgort year period
|000000000007000007|3010 |100 |2008 | 04
|000000000007000007|3010 |100 |2008 | 05
|000000000007000007|3010 |500 |2008 | 05
|000000000007000008|3010 |100 |2008 | 05
|000000000007000008|3010 |500 |2006 | 05
|000000000007000008|3010 |500 |2008 | 05
i need the following result :
000000000007000007|3010 |100 |2008 | 05
000000000007000007|3010 |500 |2008 | 05
000000000007000008|3010 |100 |2008 | 05
000000000007000008|3010 |500 |2008 | 05
it means that i need the max "period" for each matnr werks lgort year.
i can sort the table by matnr werks lgort year period DESCENDING.
An then, what is the step ?
thanks a lot, full points if helpul,
Mário.
‎2008 May 26 10:24 PM
Hi Mario,
Here it is...
1.First you have to sort itab by all the 5 field with period alone as descending.
2.While Deleting adjacent duplicates remove "period" field.
sample code:
Sort itab by matnr werks lgort year period descending.*
Delete Adjacent duplicates from itab comparing matnr werks lgort year.
Regards,
Vigneswaran S
‎2008 May 26 8:55 PM
Hi,
The best way would be in selection with MAX and GROUP BY.
You wrote right, using sort, after using loop with comparing the fields changes.
Hope it helps.
‎2008 May 26 8:59 PM
thanks for your answer !!
but can i put the code to check the changes ? i tryed but with no success !!
thanks in advance,
Mário.
‎2008 May 26 9:35 PM
After your sort use:
DELETE ADJACENT DUPLICATES FROM itab COMPARING matnr werks lgort year.
and you will have the result you want.
Greetings,
Gert
‎2008 May 26 10:24 PM
Hi Mario,
Here it is...
1.First you have to sort itab by all the 5 field with period alone as descending.
2.While Deleting adjacent duplicates remove "period" field.
sample code:
Sort itab by matnr werks lgort year period descending.*
Delete Adjacent duplicates from itab comparing matnr werks lgort year.
Regards,
Vigneswaran S