Hi,
Whenever you try to reverse the IR, do a substitution to change the value in the field Assignment (ZUONR) to some fixed text. So, the automatic clearing will not fail to pick this document.
Pre-requisite: To identify that the IR is a reversal document, Check for BKPF-AWTYP = 'MKPF' and BKPF-TCODE = 'MIRO' and BKPF-XREVERSAL = 'X'
Then BSEG-ZUONR=Some fixed text.
BR, D'nesh