There is no outright way to assign a reason code for invoice cancellation. But should you require it imperatively, you may capture the information in the following places within the cancelled invoice document while creating the cancel document and before saving it:
1. Item details –> Sales order data –> “Use” You need to adapt yourself to it though, as its basically meant for the “use of the material” but if you maintain your cancel reasons in the same list with suitable differentiating entries whereby they can be chosen. Technical names are : table name : VBRP, Field name : VKAUS.
2. Alternatively or simultaneously you may maintain details of the transaction and / or the reasons thereof in the Header –> Header text and similarly in the item text too.