‎2007 Mar 09 7:22 AM
I would like to retrieve last document flow's document. i use VBFA and pass Preceding sales and distribution document to where condition and get Subsequent sales and distribution document but i don't know how to get the latest one.
I use
select single VBELN into last_doc from vbfa
where VBELV = 'preceding doc'
order by ERDAT ERZET
but it's not work. How can i do that. Thanks!
‎2007 Mar 09 7:32 AM
Hi,
Give descending..
select VBELN UP TO 1 ROWS
into last_doc from vbfa
where VBELV = 'preceding doc'
order by ERDAT ERZET <b>DESCENDING</b>
ENDSELECT.
THanks,
Naren
‎2007 Mar 09 7:42 AM
The Error "The SELECT SINGLE statement cannot contain the clause ORDER BY." Thanks
‎2007 Mar 09 7:34 AM
‎2007 Mar 09 7:50 AM
try like this
data : begin of vbfat occurs 0,
last_doc like vbfa-vbeln,
last_date like vbfa-erdat,
end of vbfat.
select vbeln max( erdat ) into table vbfat from vbfa
where VBELV = 'preceding doc'
group by vbeln.
loop at vbfat.
<do the processing.>
endloop.
regards
shiba dutta