When you click the “Accounting Ledger” button, it makes GL entries but rolls back the transaction.
Check below code for reference