Module types

Configuration can include various module types. The modules can belong to certain objects (such as forms), or they can exist independently (belong to a configuration as a whole).

The platform uses the script stored in the modules at predefined points of 1C:Enterprise operation. These points are referred to as events and we have discussed them earlier.

The following module types are available in 1C:Enterprise.

1. Managed application module. It is executed when 1C:Enterprise is started in a thin client or web client modes.

You can declare variables and define procedures and functions in this module, and they will be available to all configuration modules (except the external connection module). They are also available for nonglobal common modules with the Client (managed application) property enabled. Exported procedures and functions of common modules are available in the managed application module context.

To open a managed application module

  • In the configuration object tree, right-click the BeginnerGuide root item and click Open managed application module (fig. 5.1).


    Fig. 5.1. Opening the managed application module

2. Common modules. They store the procedures and functions that are called from other modules. A common module itself is never executed, it simply stores the procedures and functions.

To open a common module

  • In the configuration object tree, expand the Common branch, then expand the Common modules branch and double-click the module (fig. 5.2).


    Fig. 5.2. Opening a common module

3. Object modules. Examples of such modules are a catalog item module and a document module.

An object module is called when an object is created using 1C:Enterprise script (for example, the CreateItem() method of a catalog manager is called, or the CreateDocument() method of a document manager), or when a user creates an object (for example, a catalog item or a document).

When modified object data is recorded to the database, event handlers located in the object module are called.

For details on the event sequence during the writing of modified configuration objects, see chapter Quick developer reference.

To open an object module

  • In the configuration object editor, click the Other tab and then click Object module (fig. 5.3).
    -OR-
    In the configuration object tree, right-click the object and then click Open object module.


    Fig. 5.3. Opening an object module

4. Form modules. Each form that is defined in a configuration has its own module. This module is executed when the ManagedForm object of 1C:Enterprise script is created. The platform creates this object in 1C:Enterprise mode when a form is opened either using 1C:Enterprise script (the GetForm() or OpenForm() method) or interactively.

To open a form module

  • In the configuration object tree, expand the object and open its subordinate Form object, then click the Module tab (fig. 5.4).


    Fig. 5.4. Opening a form module

5. Session module. It is executed when the configuration is loaded during 1C:Enterprise startup. A session module is intended to initialize the session parameters and execute the session-related actions. It cannot contain exported procedures or functions. It can call procedures from the common modules.

To open a session module

  • In the configuration object tree, right-click the BeginnerGuide root item and click Open session module (fig. 5.5).


    Fig. 5.5. Opening a session module

6. External connection module. It is intended for storing functions and procedures that can be called in an external connection session.

To open a session module

  • In the configuration object tree, right-click the BeginnerGuide root item and click Open external connection module (see fig. 5.5).

7. Manager modules. Each application object has a manager that manages the corresponding configuration object. Using this manager, you can create objects and perform operations with their forms and templates. A manager module allows you to extend the functionality of default managers provided by the platform by writing procedures and functions in 1C:Enterprise script.

In fact, this allows you to define custom methods for a configuration object (for example, a catalog) that do not refer to a specific database object instance, but rather to the configuration object itself.

To open a manager module

  • In the configuration object editor, click the Other tab and click Manager module.
    -OR-
    In the configuration object tree, right-click the object and click Open manager module.


    Fig. 5.6. Opening a manager module

8. Command modules. The entire configuration and its applied objects can have subordinate configuration objects referred to as Commands. Each command has a command module. You can use this module to create a predefined CommandProcessing() procedure, which is called when the command is executed.

To open the module of a command subordinate to a configuration object

  • In the configuration object editor, click the Commands tab and double-click the command (fig. 5.7).
    -OR-
    In the configuration object tree, right-click the command and click Open command module.


    Fig. 5.7. Opening a module of a configuration object command

Next page: Form module context