----------------------------------------------------------------------
selection-screen begin of block b01 with frame title text-b01.
parameters: p_dwerk like zfdwstatus-werks default '1000' obligatory,
p_vdatu like zfdwstatus-vdatu obligatory.
selection-screen end of block b01.
selection-screen begin of block b02 with frame title text-b02.
select-options: s_vbeln for zwvbak_curr-vbeln.
selection-screen end of block b02.
----------------------------------------------------------------------
data: d_task(5) type n.
data: d_vbeln like vbak-vbeln,
d_loop type i,
d_zzrun like zfdwstatus-zzrun.
data: t_vbak like vbak occurs 0 with header line.
data: t_vbap like vbapvb occurs 0 with header line.
data: t_vbep like vbepvb occurs 0 with header line.
data: t_vbkd like vbkdvb occurs 0 with header line.
data: t_vbpa like vbpavb occurs 0 with header line.
data: t_vbuk like vbukvb occurs 0 with header line.
data: t_vbup like vbupvb occurs 0 with header line.
data: begin of t_orders occurs 0,
vbeln like vbak-vbeln.
data: end of t_orders.
----------------------------------------------------------------------
at selection-screen.
if sy-batch eq space.
if sy-ucomm = 'ONLI'.
message e000(zwave) with
'Delivery Create Program can'
'ONLY be run in Background mode!!'.
stop.
endif.
endif.
***lock the plant and delivery date to prevent simulatenous delivery creations
perform lock_zfdwstatus_record using p_dwerk
p_vdatu.
perform create_deliveries.
****Unlock Status Record
perform unlock_zfdwstatus_record using p_dwerk
p_vdatu.
end-of-selection.
&---------------------------------------------------------------------
*& Form create_deliveries
&---------------------------------------------------------------------
form create_deliveries.
when '3'.
if d_loop = 1.
wait up to '0.01' seconds.
elseif d_loop = 2.
wait up to '0.1' seconds.
else.
wait up to 1 seconds.
endif.
when others.
exit.
endcase.
endif.
enddo.
endloop.
if sy-subrc ne 0.
message i000(zwave) with 'No records for the given Selection!'.
else.
message s000(zwave) with 'Deliveries successfully processed!'.
endif.
endform. " create_deliveries
*---------------------------------------------------------------------
* Form get_data
*---------------------------------------------------------------------
form get_data.
select distinct vbeln into table t_orders
from zwvbak_curr
where vbeln in s_vbeln and
vdatu = p_vdatu and
werks = p_dwerk.
*** Ignore Orders for which Deliveries already created
loop at t_orders.
select single * from vbfa where
vbelv = t_orders-vbeln and
vbtyp_n = 'J'.
if sy-subrc eq 0.
delete t_orders.
endif.
endloop.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
All product names are trademarks of their respective companies. SAPNET.RU websites are in no way affiliated with SAP AG. SAP, SAP R/3, R/3 software, mySAP, ABAP, BAPI, xApps, SAP NetWeaver and any other are registered trademarks of SAP AG. Every effort is made to ensure content integrity. Use information on this site at your own risk.