Search icon
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Programming Microsoft Dynamics 365 Business Central - Sixth Edition

You're reading from  Programming Microsoft Dynamics 365 Business Central - Sixth Edition

Product type Book
Published in Apr 2019
Publisher Packt
ISBN-13 9781789137798
Pages 536 pages
Edition 6th Edition
Languages
Authors (3):
Marije Brummel Marije Brummel
Profile icon Marije Brummel
David Studebaker David Studebaker
Profile icon David Studebaker
Christopher D. Studebaker Christopher D. Studebaker
Profile icon Christopher D. Studebaker
View More author details

Table of Contents (12) Chapters

Preface Introduction to Business Central Tables Data Types and Fields Pages - The Interactive Interface Queries and Reports Introduction to AL Intermediate AL Advanced AL Development Tools Successful Conclusions Assessments Other Books You May Enjoy

Codeunits

A codeunit is a container for chunks of AL code to be called from other objects. These chunks of code are called procedures. Procedures can be called from any of the other Business Central object types that can contain AL code. Codeunits can also be exposed (published) as web services. This allows the procedures within a published codeunit to be invoked by external routines.

Codeunits are suited structurally to contain only procedures. Even though procedures could be placed in other object types, the other object types have superstructures that relate to their designed primary use, such as pages, and reports.

Codeunits act only as containers for AL coded procedures. They have no auxiliary procedures, no method of direct user interaction, and no predefined processing. Even if we are creating only one or two procedures and they are closely related to the primary activity of a particular object, and if these procedures are needed from both inside and outside of the report, the best practice is still to locate the procedures in a codeunit.

There are several codeunits being delivered as part of the standard Business Central product, which are really function libraries. These codeunits consist completely of utility routines, and are generally organized on some functional basis (for example, associated with dimensions, some aspect of manufacturing, or some aspect of warehouse management). Many of these can be found by filtering the codeunit names on the Management and Mgt strings (the same could be said for some of the tables with the Buffer string in their name). When we customize a system, we should create our own procedure library codeunits to consolidate our customizations and make software maintenance easier. Some developers create their own libraries of favorite special procedures, and include a procedure library codeunit in systems on which they work.

You have been reading a chapter from
Programming Microsoft Dynamics 365 Business Central - Sixth Edition
Published in: Apr 2019 Publisher: Packt ISBN-13: 9781789137798
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €14.99/month. Cancel anytime}