{"title":"General Journal Post Line Overview","url":"https://jonas-paprotka.de/docs/design-details-general-journal-post-line-overview/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/design-details-general-journal-post-line-overview, MicrosoftDocs/dynamics365smb-docs at 46907ac (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/design-details-general-journal-post-line-overview","source":{"name":"Business Central application docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-docs","commit":"46907ace177f8d31deba47a2fdb57c3336e66252","date":"2026-11-19"},"checked":"2026-11-19","description":"This topic introduces changes to Codeunit 12, Gen. Jnl.-Post Line, and is the only place to insert general ledger, VAT, and customer and vendor ledger entries.","date":"2021-06-15","meta":{"topic":"overview"},"outline":[{"level":2,"title":"Old Architecture","slug":"old-architecture","at":583,"chars":2128},{"level":3,"title":"New Architecture","slug":"new-architecture","at":1873,"chars":838},{"level":2,"title":"Related information","slug":"related-information","at":2711,"chars":371}],"text":"Codeunit 12, Gen. Jnl.-Post Line, is the major application object for general ledger posting and is the only place to insert general ledger, VAT, and customer and vendor ledger entries. This codeunit is also used for all Apply, Unapply and Reverse operations.\nIn Microsoft Dynamics NAV 2013 R2, the codeunit was redesigned because it had become very large, with approximately 7,600 code lines. The architecture was changed and the codeunit has been made simpler and more maintainable. This documentation describes the changes and provides information that you will need for upgrade.\n## Old Architecture\nThe old architecture had the following features:\n There was extensive use of global variables, which increased the possibility of hidden errors due to use of variables with the wrong scope.\n There were many long procedures (with more than 100 code lines) that also had high cyclomatic complexity (that is, a lot of CASE, REPEAT, IF nested statements), which made the code very difficult to read and maintain.\n Several procedures that were only used locally and were only meant to be used locally were not marked as local.\n Most procedures had no parameters and used global variables. Some used parameters and overrode global variables with locals.\n Code patterns for searching the general ledger accounts and creating general ledger and VAT entries was not standardized and varied from place to place. In addition, there was a lot of code duplication and broken symmetry between customer and vendor code.\n A large part of the code in codeunit 12, approximately 30 percent, related to payment discount and tolerance calculations, although these features are not needed in many countries or regions.\n Posting, Apply, Unapply, Reverse, Payment Discount and Tolerance, and Exchange Rate Adjustment were married together in codeunit 12 using a long list of global variables.\n### New Architecture\nIn Business Central, codeunit 12 has had the following improvements:\n Codeunit 12 has been refactored into smaller procedures (all less than 100 code lines).\n Standardized patterns for the search of general ledger accounts have been implemented by using helper functions from Posting Group tables.\n A Posting Engine Framework has been implemented to manage the start and finish of transactions and to isolate the creation to general ledger and VAT entries, the collection of VAT adjustment, and the calculation of additional currency amounts.\n Code duplication has been eliminated.\n Many helper functions have been transferred to corresponding customer and vendor ledger entry tables.\n The use of global variables has been minimized, so that each procedure uses parameters and encapsulates its own application logic.\n## Related information\ndesign-details-posting-interface-structure\ndesign-details-posting-engine-structure\nDesign Details: General Journal Post Line (Dynamics NAV)<https://learn.microsoft.com/dynamics-nav-app/design-details-general-journal-post-line>\nFind free e-learning modules for Business Central here<https://learn.microsoft.com/training/dynamics365/business-central>"}