Deleting a Payment Journal (Leaves Applied Entries Behind)

For sometime if you delete a payment journal it leaves behind vendor ledger entries with Applied to ID Set which means that when you run the suggest vendor payments for a second time it errors. The solution is to go into the vendor ledger entries and remove it manually.

Why does this happen and is there a solution ?.

Thank you

It should clear the reference also from ledger entry as there is function written on OnDelete trigger to clear this
Check this function on Table No 81 OnDelete Trigger :- ClearCustVendApplnEntry