04-15-2009 12:56 PM
Hi to every one
Can any one tell me how to get the latest updated record using select single.
Edited by: vinay raj on Apr 15, 2009 2:06 PM
04-15-2009 1:32 PM
04-15-2009 1:06 PM
Hi,
Can you write you select statement here?
I think you are not using key fileds in where condition.
Regards
Krishna
04-15-2009 1:10 PM
Hi Vinay,
You can do one thing.
take the records into table ITAB. insetead of SELECT SINGLE.....
then do below
SORT itab by date DESCENDING.
read table itab into wa with index 1.
if sy-subrc = 0.
append wa to itab_new..
endif.
now your ITAB_NEW having the latest record
Thanks!
04-15-2009 1:18 PM
Hi
Iam using this in smart form.
I want to display the latest process order number from afpo table.
the query is as follows :
select single aufnr from afpo into g_aufnr where matnr = caufvd-matnr.
CAUFVD is the structure.
04-15-2009 1:26 PM
hi,
try this it will get the latest process order number from afpo table
*latest process order number from afpo table.
SELECT max(aufnr) from afpo into g_aufnr
where matnr = caufvd-matnr
Regards,
Prabhudas
04-15-2009 1:29 PM
Hi,
Just verify is there any field is storing the creation or changing time of order. Otherwise there must be a date field. try to use those fields.
04-15-2009 1:32 PM
04-15-2009 1:36 PM
Hi,
If you have something unique for identifying that last value in your table than use select single with where condition for retrieving last record.
Otherwise use
Select.
endselect.
for retrieving your last record from multiple line item.
Regards,
Himanshu
04-15-2009 1:41 PM
do one thing...
use if there is a date field use like this ..
sort it_tab by date descending .
read table it_tab index 1.
04-15-2009 1:44 PM
Hi,
use stmt.....
select max(AUFNR) from AFPO into var.
regards,
ajit.
04-15-2009 1:46 PM
hi
use this
select the dat into itab1
SORT itab1 by date DESCENDING.
read table itab1 into w_itab with index 1.
if sy-subrc = 0.
append w_itab to itab2..
endif.
04-15-2009 2:10 PM
04-15-2009 2:11 PM