Application Development 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: 

Last date wise data

Former Member
0 Kudos

Hi,

I have an internal table that was many fields including the asset number and Validation date each asset number can have 1,2,3 or more entries according to the number of times the cost centre of the asset had been changed in that internal table that i have with all the asset numbers and dates i wanted only the latest or the asset with other data only for the last valid date is there a way of achieving it.

1 ACCEPTED SOLUTION

Former Member
0 Kudos

data : wtab like itab.

sort itab by assetno date descending.

read table itab into wtab index 1.

delete itab where date ne wtab-date.

now your itab contains the datas of latest valid dates <it may contain more than 1 row>.

regards

shiba dutta

5 REPLIES 5

Former Member
0 Kudos

Hi,

use this:

sort itab by dtae descending.

read table itab index 1.

regards,

keerthi

Former Member
0 Kudos
  • Select the data

*sort desending by validate dates

*and delete adjecent dulicates comparing asset number ( so latest record will remain,,,)

-> u can also mention desending order on dates in select query...but above 3steps will b faster compar to using desending in select statement....

Ramesh.

Former Member
0 Kudos

Hi,

sort the table on the date in descending order so that the last date will come as the first entry of the table. then read the table with index 1.

Ex:

sort it_table by date descending.

read it_table index 1.

If this doesn't solve the purpose then explain your prob in a little more details.

Regards,

Kirti.

Former Member
0 Kudos

data : wtab like itab.

sort itab by assetno date descending.

read table itab into wtab index 1.

delete itab where date ne wtab-date.

now your itab contains the datas of latest valid dates <it may contain more than 1 row>.

regards

shiba dutta

Former Member
0 Kudos

Thanks...