I've been trying to create a general ledger entry that would reverse the desired purchase transaction (or a part of transaction). All I really want to do is find the one general ledger entry and post it with negative amount, then post it again to another account. I'm using BC15 and the only event I found, that would allow me to do such a thing, seems to be OnAterPostPurchaseDoc. I intended to find the related purchase invoice lines and fill a general journal line with adequate values, then use "Gen. Jnl.-Post Line" codeunit to post it, but I just can't get it right.
Do you have any clues on how should I approach this task?