Every object needs to specify a value for the Access property
When you define a codeunit, table, query, enum, interface, or permission set without setting the Access
property, the platform defaults it to Public. The object becomes accessible to every extension that takes a dependency on yours — whether or not you intended it as part of the public API.
Once a dependent extension references the object, reducing its access level to Internal is a breaking change. A helper codeunit or staging table left at the default permanently locks into the public surface.
Set Access explicitly on every object — Internal for implementation details, Public for objects that are part of the intended API.
Example
codeunit 50100 "Sales Document Management" // Every object needs to specify a value for the Access property [PC0006]
{
}When the object is an internal implementation detail, set Access = Internal:
codeunit 50100 "Sales Document Management"
{
Access = Internal;
}When the object is part of the public API surface, set Access = Public to make the decision explicit:
codeunit 50100 "Sales Document Management"
{
Access = Public;
}When the diagnostic is reported
- The object is a codeunit, table, query, enum, interface, or permission set.
- The
Accessproperty is not set. - For enums and interfaces, the app targets runtime 7.0 or later (Business Central 2021 release wave 1).
See also
- Using Access Modifiers in AL on Microsoft Learn