Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

internal table values delete

Former Member
0 Likes
511

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

4 REPLIES 4
Read only

Former Member
0 Likes
490

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).

Read only

uwe_schieferstein
Active Contributor
0 Likes
490

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 itab

Regards

Uwe

Read only

Former Member
0 Likes
490

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.

Read only

varma_narayana
Active Contributor
0 Likes
490

Hi..

TRY THIS WAY...

Sort itab by EBELN MATNR DESCENDING .

DELETE ADJACENT DUPLICATES FROM ITAB COMPARING EBELN.

REWARD IF HELPFUL.