2008 Jul 14 5:05 AM
Hi ,
Can any one please help how to select maximum or latest entry of the date out of the 6 or 7 entries i got for the given input as say for instance sy-datum(14-07-2008).
Thanks in advance
2008 Jul 14 5:08 AM
If it is in internal table. Sort the internal table by descending and pick the first record.
Sort itab by datum descending.
Read table itab into ws_itab index 1.
If you need to read from database tgable, use the statement MAX( ERDAT ) in your select statement.
Regards,
Subramanian
2008 Jul 14 5:08 AM
If it is in internal table. Sort the internal table by descending and pick the first record.
Sort itab by datum descending.
Read table itab into ws_itab index 1.
If you need to read from database tgable, use the statement MAX( ERDAT ) in your select statement.
Regards,
Subramanian
2008 Jul 14 5:40 AM
Hi johny ,
As you said you are taking input values from user thrugh the selection screen,what you can do is save each input in an internal table and then sort the internal tabledescending by date. This gives you the latest entry.
Best of luck,
Bhumika
2008 Jul 14 5:50 AM
Hi Johny,
Try this code :
SELECT-OPTIONS:
s_date FOR sy-datum.
SORT s_date BY low DESCENDING.
LOOP AT s_date.
READ TABLE s_date INDEX 1.
WRITE 😕 s_date-low.
ENDLOOP.
For the select-options s_date give some values and check. It will fetch you the latest date among the entries you gave as input.
Regards,
Swapna.
2008 Jul 14 5:53 AM
Hi,
You can also ORDER BY Statement in your Select Query to get the the data into Internal table in Date Descending-
Like-
Select * from Ztable into table itab ORDER BY Date DESCENDING.
In This case you will get First the Record with Latest Date.
Hope it will help you.
Regards,
Sujit
2008 Jul 14 5:56 AM
hi,
If you have used your date field as a Select-options then
you can access maximum date using this satatement.
write <fieldname>-high.
2008 Nov 28 9:31 AM