Lately, I found several requests on this question 'return order can be created with reference of a cancelled invoice'. Most customer is questioning why system behaves like this and ask what 's the best way to avoid it. So here I'd like to explain it in a short blog and give you some hint for it.
First we need to understand it is standard system behavior that it is possible to create documents (for example returns, credit memo, debit memo) with reference to a cancelled invoice. Normally 'copying requirements 021 billing header' is used in the copy control from billing to returns. (Transaction: VTAF)
The copy requirement routine 021 does not have any check for the field VBRK-FKSTO = X (billing document is cancelled). So it is allowed to create such document.
If you want to avoid the creation of documents when the invoice has been cancelled, you need to add the check for 'VBRK-FKSTO = X' in the requirement routine.
You could either modifying standard routine 021 or creating your own requirement routine in VOFM by copying the same coding in 021 and include the check for VBRK-FKSTO.
You may let me know if you had another good way to avoid such behavior.