Creating and posting a ledger voucher
In Dynamics AX, all financial transactions, regardless of where they are originated, end up in the General ledger module. When it comes to customized functionality, developers should use Dynamics AX APIs to create the required system entries. No transactions can be created directly in the tables as it may affect the accuracy of financial data.
In order to ensure data consistency, the system provides numerous APIs for developers to use. One of them is ledger voucher processing. It allows posting a financial voucher in the General ledger. Vouchers in Dynamics AX are balancing financial entries representing a single operation. They include two or more ledger transactions. The ledger voucher API ensures that all required criteria, such as voucher numbers, financial periods, ledger accounts, financial dimensions, balances, and others, are valid.
In this recipe, we will demonstrate how a ledger voucher can be created and posted from code. We will create a single...