‎2007 Jun 05 5:36 AM
Hi,
I want to collect the latest date from a table containing a number of dates.
how do i achieve dis???
‎2007 Jun 05 5:41 AM
Hi,
try this..
select max( date ) into v_date from ztable.
select max( time ) into v_time from ztable.
‎2007 Jun 05 5:38 AM
Hi,
Sort the date in descending order and then read the first table entry.
Hope this helps.
Regards,
Richa
‎2007 Jun 05 5:38 AM
Hi,
<b>For internal table..</b>
SORT ITAB BY DATE DESCENDING.
get the latest date
READ TABLE ITAB INTO WA INDEX 1.
<b>For database table</b>
SELECT MAX( DATE) INTO V_DATE FROM ztable WHERE ..
Thanks,
Naren
‎2007 Jun 05 5:38 AM
sort it_tab by <date> descending.
read it_tab index 1.
Regards
Gopi
‎2007 Jun 05 5:38 AM
SORT itab BY date DESCENDING.
Now your first record will have latest date.
Reward points if useful.
Regards,
Atish
‎2007 Jun 05 5:39 AM
Hi
Sort the date in descending order and then read the first table entry
Regards,
Sree
Message was edited by:
sree ram
‎2007 Jun 05 5:39 AM
DATA : BEGIN OF ITAB OCCURS 0,
VDATE LIKE SY-DATUM,
END OF ITAB.
SELECT MAX( <DATE FIELD> ) INTO TABLE ITAB FROM DBTAB WHERE <CONDITION>.
LOOP AT ITAB.
WRITE : ITAB-VDATE.
ENDLOOP.
REGARDS
SHIBA DUTTA
‎2007 Jun 05 5:39 AM
Hi
Can you be little more clear with your requirement?
with respect to which module or which table you are asking this?
Regards
Anji
‎2007 Jun 05 5:41 AM
Hi,
try this..
select max( date ) into v_date from ztable.
select max( time ) into v_time from ztable.
‎2007 Jun 05 5:42 AM
Hi,
U can get the latest date by sorting ur internal table with key as date descending.
{Also if u coding in HR abap,
use <b>rp_provide_from_last p0001 space pn-begda pn-endda</b>
This wil help u to fetch the latest records for the entered begin date and end date.}
Hope this helps.
****Rewars points if helpful.
All the best