The SUBDIALOG clause attaches a declarative dialog to the current procedural DIALOG block. The declarative dialog will be implemented outside of the scope of the current dialog, at the same level as a function. The declarative dialog can be defined in a different module.
In terms of semantics, behavior and control block execution, a declarative dialog attached to a procedural dialog behaves like a sub-dialog that is defined inside the procedural DIALOG block. For example, the BEFORE INPUT control block will be executed for a declarative dialog when the focus goes to one of the fields of that sub-dialog.
Other sub-dialogs can reference the attached declarative dialog in the current scope, for example to execute a NEXT FIELD instruction referencing a field in another sub-dialog.
When using the DIALOG keyword inside a declarative dialog block to use ui.Dialog class methods, it references the current procedural dialog object.
Like other module elements such as functions and reports, the name specification is mandatory when defining a declarative dialog. The name of the declarative dialog will be referenced in a SUBDIALOG clause of a procedural dialog instruction.
Implementing a sub-dialog as a declarative dialog in a separate module can be used in conjunction with the form inclusion directive in the LAYOUT section of form specification files. With form inclusion and declarative dialogs, you enforce code reusability in your application sources.
Note that declarative dialog blocks can also be used to implement parallel dialogs.