Bank reconciliation variance

I got a vendor refund which was entered as A/P adjustment since I wanted to clear the aging report balance and it did end up in the chart in the respective account by clearing the aging report. But, Epicor was not retrieving any A/P adjustments on to the Bank statement processing un-matched lines. So, I created a statement line manually but was not able match it against the debit memo either. Finally, I recorded it as a undefined line with the unallocated amount, but the reconciliation report equaled the bank balance by recognizing that undefined line, manually entered refund amount, as a variance. Now, the variance in the Bank reconciliation report affects the journal entry after posting which ended up as a duplicate recognition,

Now my question is, what is the right way to handle this situation?

I am new to this software and I appreciate heartfully any detailed explanation.