Backorders reset.

 

 

--Backorders

Insert into proddta.F559004 (ooev01,ookcoo,oodoco,oodcto,oolnid,ooshan)

select distinct 'C',sdkcoo,sddoco,sddcto,sdlnid,sdshan 

from proddta.F4211 

join proddta.F0111 on wwan8=sdan8 and wwtyc='S'

left join proddta.F559004 on sdkcoo=ookcoo and sddoco=oodoco and sddcto=oodcto and sdlnid=oolnid

where sdkcoo='00300' and sddcto='SO' and sdnxtr='540' and oodoco is null

and sdan8 =585300