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: 

how to extract the record with latest date

Former Member
0 Kudos

in internal table i a have 10 records, in that for each record only date is changing...so,now the issue is i should extract the record which having the latest date

1 ACCEPTED SOLUTION

Former Member
0 Kudos

Hi ,

Sort the internal table with descending date and read the first recrod.

e.g.

<b>SORT IT_1 by DATS DESCENDING.

Read table it_1 index 1.</b>

Regards

Arun

  • Please reward with point if reply is helpful

5 REPLIES 5

Former Member
0 Kudos

Hi ,

Sort the internal table with descending date and read the first recrod.

e.g.

<b>SORT IT_1 by DATS DESCENDING.

Read table it_1 index 1.</b>

Regards

Arun

  • Please reward with point if reply is helpful

Former Member
0 Kudos

sort the internal table in decending order.

and now read index one for latest record.

Former Member
0 Kudos

Hi,

sort the internal table by in descending order. And pick the first record of internal table.

Rgds,

Prakash

0 Kudos

try this code -

data: begin of itab occurs 0,

name(20),

add(20),

bp like sy-datum,

end of itab.

itab-name = 'aaa'.

itab-add = '123'.

itab-bp = '20061220'.

APPEND ITAB.

CLEAR ITAB.

itab-name = 'bbb'.

itab-add = '123'.

itab-bp = '20061219'.

APPEND ITAB.

CLEAR ITAB.

itab-name = 'aaa'.

itab-add = '123'.

itab-bp = '20061222'.

APPEND ITAB.

clear itab.

sort itab descending by bp.

read table itab index 1.

write: itab.

Former Member
0 Kudos

sort itab by date descending.

read table itab index 1.

or sort itab by <fnames> ascending date descending.

<here wa is of line type of itab>

loop at itab into wa.

at new <faname>.

<now wa contains the latest date vale take that value to any variable>

endat

endloop.

regards

shiba dutta