Module types

Managed application module
Session module
External connection module
Ordinary application module
Common modules
Common object modules
Applied object modules
Applied object manager modules
Command modules (common command modules)
Managed form modules
Form modules

1C:Enterprise supports a number of software module types. They differ in their location and available context.

Managed application module

The managed application module is located in the root part of the configuration. It contains event handler procedures that are initialized on 1C:Enterprise startup and shutdown with the Default run mode property set to Managed application. The managed application module allows declaration of variables, and declaration and description of procedures and functions that will be available in any configuration module (except for the external connection module). They are also available in nonglobal common modules with the Client (managed application) property set. Exported procedures and functions of common modules are available in the managed application module context.

Session module

The session module is a module that is executed automatically on 1C:Enterprise startup, when a configuration is loaded.

The session module is intended for initializing session parameters and performing session-related operations. In a 1C:Enterprise server cluster the session module is always executed in the privileged mode.

Important! The session module can only contain definitions of procedures and functions.

It does not contain exported procedures and functions and can use procedures from common configuration modules.

External connection module

The external connection module is located in the root part of the configuration. It contains event handler procedures that are initialized on 1C:Enterprise startup and shutdown in the external connection mode (COM connection).

The external connection module allows declaration of variables, and declaration and description of procedures and functions that will be available to an external application and to nonglobal common modules with the External connection property set.

1C:Enterprise objects that are available externally through COM connection are as follows:

  • Exported variables, procedures, and functions of the external connection module
  • Exported procedures and functions of common modules
  • Including and excluding entire common modules by specifying their properties
  • Including and excluding certain parts of common modules using preprocessor instructions
  • Global 1C:Enterprise context
  • Except for objects that are tightly connected to the client application (TextDocument, SpreadsheetDocument, and so on)

The module is available only in the external connection session.

No user interface is available in this mode.

Ordinary application module

The ordinary application module is located in the root part of the configuration. It contains event handler procedures that are initialized on 1C:Enterprise startup and shutdown with the Default run mode property set to Ordinary application. The ordinary application module allows the declaration of variables, and declaration and description of procedures and functions that will be available in any configuration module (except for the external connection module). They are also available in nonglobal common modules with the Client (managed application) property set. Exported procedures and functions of common modules are available in the ordinary application module context.

Common modules

Common modules are located in a dedicated branch of the metadata tree. Common modules are primarily designed to keep common configuration algorithms accessible from other modules. Common modules do not include the variable definition section and the main program section, thus they only have the procedure and function section (see section Program module structure).

You can declare and describe procedures and functions that you want to be accessible from any configuration module in any common module.

In the client/server mode you can execute common module procedures and functions on the application server or on the client side using the Client (ordinary application), Client (managed application), and Server properties and preprocessor instructions.

If the Client (ordinary application) or Client (managed application) property is set, all procedures and functions of a common module can be used in the client application.
Exported variables, procedures, and functions of the ordinary application module are accessible in the nonglobal common module context if the common module has the Client (ordinary application) property set.
Exported variables, procedures, and functions of the managed application module are accessible in the nonglobal common module context if the common module has the Client (managed application) property set.

Important! The Client (ordinary application) property is only displayed when the Managed application and ordinary application mode is specified in the configuration settings.

If the Server property is set, all procedures and functions of the common module are accessible in the client/server mode.

If you want the module procedures and functions to be accessible from external connections, set the External connection property.
Exported variables, procedures, and functions of the external connection module are accessible in the nonglobal common module context if the common module has the External connection property set.

If the Server call property is selected, server calls are allowed. This property becomes available if the Server property is set. Otherwise the procedures and functions of this module can be accessed only on the server. When the property is set, procedures and functions of this module are available on the client side.

The Privileged property is used to provide full access rights for the execution of database-related operations within procedures and functions of a common module. With the property set, these are executed only on the server.

The Reuse return values property becomes available if the module is not Global. This property can have the following values:

  • Do not use. Reusing return values for functions of this common module is not allowed.
  • During call and During session. The return values can be reused. The system stores the function parameters and results after the first function call. When the function is called with the same parameters again, the function is not executed and the stored values are returned instead. But if the function execution changes its parameters, the return values are not reused.

Storing the function results has some specifics.

  • When a function is executed on the server and is called from the server script, the parameter values and the function result are stored for the current session on the server side.
  • When a function is executed in a thick or thin client, the parameter values and the function result are stored on the client side.
  • When a function is executed on the server side but called from the client script, the parameter values and function result are stored both on the client side and on the server side.

The stored values are deleted:

  • If the common module property is set to During call:
    • On the server side, when the server returns the control
    • On the client side, when the execution of the 1C:Enterprise script top-level procedure or function (called from the interface rather than from another 1C:Enterprise script procedure or function) is completed
  • If the common module property is set to During session:
    • On the server side, upon the session completion
    • On the client side, upon closing of the client application

The stored values can be deleted:

  • When they have not been used for a long period (over 5 minutes)
  • When the server working process runs out of RAM
  • When a working process is restarted
  • When the client switches to another working process

After the values are deleted, a subsequent exported function call is executed in the same way as the first call.

The Global property defines whether exported methods of the common module are a part of the global context.
When the Global property is set to True, the exported methods of the common module are available as global context methods.

When the Global property is set to False, a property is created in the global context with the name matching the name of the common module in metadata. This property is available ONLY for reading. The value of this property is a CommonModule object. Exported methods of this common module are available through this object. Thus, nonglobal common module method calls have the following format: XXXXX.YYYYY, where XXXXX is the name of the common module property, and YYYYY is the name of the exported method of the common module.

If the Client (ordinary application) property is set, the module is loaded in the thick client in the ordinary application mode.

When the Client (managed application) property is set, all procedures and functions of the common module are accessible in the managed application mode, in the thin and web clients.

Modules with the Client (ordinary application) property set are checked for the following run modes:

  • Thick client (ordinary application)
  • Thick client (ordinary application), client/server mode.

Modules with the Client (managed application) property set are checked for the following run modes:

  • Thick client (managed application)
  • Thick client (managed application), client/server mode
  • Thin client
  • Web client
Common object modules

Some common objects have their own modules. These objects include:

  • Commands
  • Web services

The modules are located in the same configuration branches that store the objects, they are actually properties of those objects. Each object has its individual module. These modules allow the declaration of variables, procedures, and functions that are accessible from 1C:Enterprise script outside the object and supplement the object context.

Applied object modules

Applied objects have their own modules. These objects include:

  • Constant value managers
  • Catalogs
  • Documents
  • Reports (external reports)
  • Data processors (external data processors)
  • Charts of characteristic types
  • Charts of accounts
  • Charts of calculation types
  • Business processes
  • Tasks
  • Registers

The modules are located in the same configuration branches that store the objects, they are actually properties of those objects. Each object has its individual module. These modules allow the declaration of variables, procedures, and functions that are accessible from 1C:Enterprise script outside the object and supplement the object context.

The applied object context provides access to the attributes and tabular sections of the object, as well as to its methods and events.

Applied object manager modules

Each application object has a manager intended for managing this object as a configuration object. The manager allows you to create objects, and work with their forms and templates. The manager module extends the manager functionality by introducing 1C:Enterprise script procedures and functions. Thus you can describe methods of a configuration object (for example, a catalogue) that are related to the configuration object itself rather than to an object instance in the database.
The context of the manager module is comprised of:

  • Global context, including exported functions of common modules (if any of the Client (ordinary application), Client (managed application), or Server properties is set for the modules)
  • Exported variables, procedures, and functions of managed or ordinary application modules
  • Local or exported functions of the module itself

A manager module cannot have variables and module body.

When functions or procedures of a manager module are declared as exported ones, they can be accessed through the object manager.

Example:
Manager module:

Function GetDebtorList() Export
…
EndFunction

Call from the application code:

Debtors = Catalogs.Contractor.GetDebtorList();
Command modules (common command modules)

A custom command requires the description of its logic. This can be done using the command module where you can write the predefined ProcessCommand() procedure. This procedure should be preceded by the &AtClient compilation directive, as the command is executed in the client application.

Managed form modules

These modules consist of procedures and functions. Module variables and the module body are not allowed.

Form modules

These modules are stored in configuration forms. Each form has its own module. These modules allow the declaration of variables, procedures, and functions that are accessible from 1C:Enterprise script outside the object and supplement the object context.

The context of the form module provides form attributes, properties, methods and events. If the main attribute is assigned to a form, properties and methods of the application object used as the main attribute become available in the form module.

1C:Enterprise Developer's Community