*&---------------------------------------------------------------------*
*& Report ZDEMO_DEL_DN
*&
*&---------------------------------------------------------------------*
*&交货单删除是物理删除
*&---------------------------------------------------------------------*
report zdemo_del_dn.
parameters p_dn type vbeln_vl.
data:lv_delivery like bapiobdlvhdrchg-deliv_numb,
ls_header_data like bapiobdlvhdrchg,
ls_header_control like bapiobdlvhdrctrlchg.
data:lt_return like table of bapiret2.
data:ls_return like line of lt_return.
clear ls_header_data.
clear ls_header_control.
clear lv_delivery.
clear lt_return[].
ls_header_data-deliv_numb = p_dn.
ls_header_control-deliv_numb = p_dn.
ls_header_control-dlv_del = 'X'.
lv_delivery = p_dn.
"Deleting delivery doc (VL02)
call function 'BAPI_OUTB_DELIVERY_CHANGE'
exporting
header_data = ls_header_data
header_control = ls_header_control
delivery = lv_delivery
tables
return = lt_return.
call function 'BAPI_TRANSACTION_COMMIT'
exporting
wait = 'X'.