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: 

select

Former Member
0 Kudos

how to select recent date record in a table

3 REPLIES 3

Former Member
0 Kudos

select * from table-name where date = max(date)

Former Member
0 Kudos

Hi Pandu,

First select all the entries into itab, Then sort it by timestamp in descending order,

then delete the entries other than first occurance.

Code,

SORT ITAB BY FIELD1 ASCENDING TIMESTMP DESCENDING.

READ TABLE ITAB INTO WA_ITAB.

LOOP AT ITAB.

IF WA_ITAB-FIELD1 = ITAB-FIELD1 AND SY-TABIX NE 1.

DELETE ITAB INDEX SY-TABIX.

ELSE.

MOVE ITAB TO WA_ITAB.

ENDIF.

ENDLOOP.

former_member198275
Active Contributor
0 Kudos

hi,

u have select data based on some field.

that may be date (if date field is there),or somthing else.

You cant select recent data without any specific field. So search for that option.