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 single

Former Member
0 Kudos

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

1 ACCEPTED SOLUTION

kesavadas_thekkillath
Active Contributor
0 Kudos

not select single.

Ex: use select max( mblnr ) from mkpf.

12 REPLIES 12

Former Member
0 Kudos

Hi,

Can you write you select statement here?

I think you are not using key fileds in where condition.

Regards

Krishna

Former Member
0 Kudos

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!

0 Kudos

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.

0 Kudos

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

0 Kudos

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.

kesavadas_thekkillath
Active Contributor
0 Kudos

not select single.

Ex: use select max( mblnr ) from mkpf.

Former Member
0 Kudos

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

former_member203501
Active Contributor
0 Kudos

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.

Former Member
0 Kudos

Hi,

use stmt.....

select max(AUFNR) from AFPO into var.

regards,

ajit.

Former Member
0 Kudos

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.

0 Kudos

Thankyou for all your replies.

My issue has been resolved.

Former Member
0 Kudos

i got the solution