‎2007 Sep 25 4:30 AM
hi friends,
i have created Materials where used report . i select all po using this materials but i want only last po of using this materials i had sorted my internal tables . i want only last field of internal table other fields i do delete how delete the internal table filed expert last filed.
how to do this please help me .
thanks and regards,
jayachandran
‎2007 Sep 25 4:37 AM
Hi,
Sort the internal table by PO descending. Then use delete command to delete records. So that you will have latest PO for each Material.
Sort itab by MATNR EBELN DESCENDING.
Delete adjacent duplicates from itab comparing matnr.
(I assume ITAB contains MATNR and EBELN).
‎2007 Sep 25 4:38 AM
Hello Jai
Assuming that the purchase order have an order date an that this would be your criteria for sorting use the following coding:
SORT lt_materials BY matnr po_date DESCENDING. " most recent PO on top
DELETE ADJACENT DUPLICATES FROM lt_materials
COMPARING matnr po_date. " most recent PO for material remains in itabRegards
Uwe
‎2007 Sep 25 4:43 AM
HI,
see this code.
data:itab like mara occurs 0 with HEADER LINE.
data:lin(3) type n.
SELECT * FROM mara into table itab.
loop at itab.
write:/ itab-matnr.
ENDLOOP.
loop at itab.
DESCRIBE TABLE itab lines lin.
if lin > 1.
delete itab.
else.
exit.
endif.
ENDLOOP.
loop at itab.
write:/ itab-matnr.
ENDLOOP.
rgds,
bharat.
‎2007 Sep 25 4:43 AM
Hi..
TRY THIS WAY...
Sort itab by EBELN MATNR DESCENDING .
DELETE ADJACENT DUPLICATES FROM ITAB COMPARING EBELN.
REWARD IF HELPFUL.