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

Reg : Abap Code

Former Member
0 Likes
359

Hi Experts ,

Im having some data in Database tablle like this .

vbeln edatu meng

123454 05.12.2006 2

123454 25.05.2007 5

123454 10.09.2007 9---> Recent data

Here sales doc no is primary Key .

i want Logic how to fetch most Recent data ?

Thanx in advance

regs

Murthy

3 REPLIES 3
Read only

gopi_narendra
Active Contributor
0 Likes
332

Write this code, you will get the recent data into itab.

sort itab by vbeln ascending
                 edatu meng descending.
delete adjacent duplicates from itab comparing vbeln edatu meng.

Regards

Gopi

Read only

former_member189059
Active Contributor
0 Likes
332

Im too lazy to write the entire code

but do these steps

select distinct sales doc into table itab

loop at the table and select max( date ) for each sales doc

select remaining fields based on sales doc and date

modify table

endloop

Read only

Former Member
0 Likes
332

try this it may work...

first of all declare an int table with three fields vbeln edatu and menge like database table...

then

select vbeln max( edatu ) menge into table itab from dbtab where <condition> group by vbeln menge.

regards

shiba dutta