07-03-2006 2:27 PM
hi to all,
i am having a query in sd-abap
actually we r having one ztable ok. in that we r having two fields namely status of particular sales orderactivity and a sequenceial number.
status field name is zhhstatus and sequential no field as zhusss.data in status is like this ex ,ddd ,sss
and sequential no for this status 1,2,3 . 3 is latest status for corresponding statuss ddd. how to write the logic for getting max status for particular sales order.
plz do this help by giving possible answers.
thanks in advance.
07-03-2006 2:29 PM
select *
from ztable
into table itab
where vbeln = <sales order number>.
sort itab by <sequence number> descending.
read itab index 1.
if sy-subrc = 0.
your itab will noe have the latest status
v_status = itab-status.
endif.
Regards,
Ravi
07-03-2006 2:33 PM
I'm not sure in alphabetic order the "ddd" is after the "ex"
Rgd
Frédéric
07-03-2006 2:32 PM
Hi,
if you would like to go fast, and if an order could have only one time a statut and must have the first statut to pass to the status 2 ... you could simply count using a group by select.
select order count( * ) into w_data from table group by order.
if w_data = 3 you have the status sss
if w_data = 2 you have the status ddd
if w_data = 1 you have the status ex
Rgd
Frédéric
Message was edited by: Frédéric Girod