Define extension objects in same app as their base object
With an extension object you can, for example, add new fields, actions, and layout to an existing page, or add data items, columns, request pages, and layouts to an existing report. With an enum extension, you can add new values to an existing enumeration.
For a base object to be extensible, it must be marked with the property Extensible = true;. The default value for all objects is that they're extensible. Therefore, you don't have to specify this property explicitly in your code.
The following lists the different extension objects that you can create in AL.
Table extension
- Add fields to an existing table.
Page extension
- Add fields, actions, and layout to an existing page.
Report extension
- Add data items, columns, request pages, and layouts to an existing report.
Enum extension
- Add new values to an existing enumeration.
Permission set extension
- Add new permissions to an existing permission set.
From runtime 13.0 and onwards, large applications can maintain a separation of concerns. This is achieved by permitting extension objects to coexist with their target within the same app. This facilitates the development of multiple extensions for a single target, all within the same app.
In metadata, extension objects remain separate, as before, so each extension object still requires its own object ID in the used range. The key change is that they can now reside in the same extension/app as the base object. With tables, table extensions that reside in the same app as the base table are merged into that table in the database schema---resulting in no companion table extension.
When table extensions live in the same app as their target, their fields and keys are integrated into the base table. This integration eliminates the need for SQL-joins during runtime.
All types of extension objects; enums, pages, reports, tables, and XMLports, can coexist with their target within the same app. This allows for various combinations, such as a single table with its table extension, a single page with multiple page extensions, multiple enum extensions, and so forth. This flexibility supports a wide range of application structures and functionalities.
Permitting extension objects to coexist with their target within the same app is useful for nondisruptive code refactoring within an app. It allows for dividing objects into modules based on specific functionalities, or for preparing to move objects into a separate app in anticipation of future releases.
With runtime 13.0, extension objects from a specific app are applied to the target based on the extension object ID.
This introduces the following new compiler validations:
Base objects are prohibited from referencing members from extension objects.
An extension object can only reference members from other extension objects within the same app if the other extension object has a lower object ID.