hi
when cancel the excise invoice automatically invoice cancel
include :MJ1IHF01
Form COMMIT_WORK
if sy-tcode = 'J1IH' and v_trans_type = 'CEIV' .
data: l_RDOC2 type J_1IEXCDTL-RDOC2.
DATA : lt_return TYPE TABLE OF bapireturn1,
lt_success TYPE TABLE OF bapivbrksuccess,
lw_return TYPE bapireturn1.
l_rdoc2 = j_1iexcdtl-rdoc2.
if l_RDOC2 is not INITIAL.
CALL FUNCTION 'BAPI_BILLINGDOC_CANCEL1'
EXPORTING
billingdocument = l_RDOC2
testrun = ''"c_space " c_x
TABLES
return = lt_return
success = lt_success.
READ TABLE lt_return INTO lw_return WITH KEY type = 'E'.
IF sy-subrc NE 0.
* CALL FUNCTION 'BAPI_TRANSACTION_COMMIT' IN UPDATE TASK.
else.
CALL FUNCTION 'BAPI_TRANSACTION_ROLLBACK'.
endif.
endif.
endif.