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

Report

Former Member
0 Likes
568

Hi,

Purchase ord number Approve date (EBELN , BUDAT)

PO1 30/09/2006

PO1 25/10/2006

PO1 12/11/2006

PO1 22/11/2006

PO2 21/07/2006

PO2 30/10/2006

PO2 24/11/2006

PO3 12/09/2006

PO3 17/10/2006

i want oput put like this.

PO Latest approved date 2nd approved date

PO1 22/11/2006 12/11/2006

PO2 24/11/2006 30/10/2006

PO3 17/10/2006 21/10/2006

can any one write this code

Thanks in Advance.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
548

Hi Sheethal,

SORT your table as

SORT itab by EBELN BUDAT DESCENDING.

Now you can delete the entires which are not required.

Regards,

Atish

5 REPLIES 5
Read only

Former Member
0 Likes
549

Hi Sheethal,

SORT your table as

SORT itab by EBELN BUDAT DESCENDING.

Now you can delete the entires which are not required.

Regards,

Atish

Read only

0 Likes
548

Hi,

already i have done it but it is not getting exctly wat i want. so plz if it is possible could u write code for me.

Thanks in Advance,

Read only

0 Likes
548

Hi Sheethal,

Can you paste your code, I will modify it for you.

Regards,

Atish

Read only

Former Member
0 Likes
548

take a itabfinal with po latest date 2nd latest date...

data : count type i.

sort itab by ebeln budat descending.

loop at itab.

at new ebeln.

count = 1.

endat.

if count le 2.

read table itabfinal with key ebeln = itab-ebeln.

if sy-subrc = 0.

itabfinal-2nddat = itab-budat.

modify itabfinal index sy-tabix.

else.

itabfinal-ebeln = itab-ebeln.

itabfinal-latestdat = itab-budat.

append itabfinal.

endif.

endif.

count = count + 1.

endloop.

sort itabfinal by ebeln.

regards

shiba dutta

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
548

try this ..i guess this may solve u r problem

first select the unique ponos into a itab.

then

DATA: wa_po TYPE table.

loop at itab.

select pono budat from table into wa_po upto 2 rows

where pono = itab-pono

order by budat descending.

endselect.

endloop.