What are the rules of exchange in 1s. Preparatory steps for setting up exchange in BP

When developing 1C 8 exchange rules, the ability to programmatically redefine the behavior of exchange rules is widely used - the handler mechanism. Event handlers significantly expand the functionality and are an indispensable tool for setting up exchange rules in cases where interactive configuration capabilities are not enough.

Handlers and algorithms are written in the language of the platform in which they will be executed during the exchange.

If this is a 1C: Enterprise 7.7 platform, then the handler code is integrated into the upload or download processing code. Accordingly, each handler or algorithm is separated into a separate function and is available for debugging during exchange.

If uploading or downloading occurs on the 1C: Enterprise 8 platform, then the handler code is not integrated into the data exchange processing code, but is uploaded to the exchange rules file. During the data exchange process, the code of handlers or algorithms is taken from the rules file and executed directly in the context of the “Run” statement. To debug the code of handlers and algorithms, you can use the processing " Universal exchange XML data".

Task

Transfer information about counterparties from UP V BP. Data is transferred unilaterally, identification is made using a unique identifier. Conversion rules are configured using a special configuration Data conversion, edition 3.0(Further - KD 3.0).

Actions Performed

Stage 1. Preparing to configure the rules.

To configure conversion rules in the configuration KD 3.0 must contain information about the structure of the information bases between which data is synchronized, as well as about the structure of the format Enterprise Data.

Step 1. Uploading the structure of the UP and BP information bases.

To download information about the structure of the infobase, processing is used MD83Exp.epf, included in the configuration package KD 3.0.

For each infobase ( UP And BP) you must perform the following steps:

  1. Open the infobase in Enterprise mode.
  2. Open external processing MD83Exp.epf(Menu File & Open).
  3. Specify the name of the file in which to save the infobase structure.
  4. Check the settings in the processing form (all flags must be cleared).
  5. Press the button Unload.

Step 2. Export the xml exchange format scheme

To download the exchange format scheme, standard platform capabilities are used.

You need to do the following:

  1. Open one of the information databases (or UP or BP) in the “Configurator” mode.
  2. In the metadata tree, find XDTO packages with names ExchangeMessage And EnterpriseData_1_0_beta.
  3. Place the cursor on the XDTO package, right-click and select the item in the context menu Export XML Schema. Specify the path and file name to export. Perform this step for each of the two packages, saving the XML schemas in two different files.

Step 3. Loading the infobase structure into the CD 3.0 configuration

Loading is performed into the configuration KD 3.0 in Enterprise mode. The following steps should be performed for each of the configurations for which conversion rules are configured ( UP And BP).

  1. Go to section Configurations, and select the command
  2. Specify the path to the file with the infobase structure (see. Stage 1, Step 1).
  3. Specify download method & V new version configurations.
  4. Press the button Execute download

Step 4. Loading the exchange format structure into the CD 3.0 configuration

  1. Go to section Data Format, and select the command.
  2. Specify files with format structure (see. Stage 1, Step 2). You must specify both files at once using multiple selection.
  3. Check the name of the main XDTO package - must match the namespace of the XDTO package EnterpriseData_1_0_beta(see in the configurator UP or BP).
  4. Specify download method & to the new version of the format.
  5. Press the button Execute download, wait for the download to finish.

Stage 2. Creating conversions

To solve the described problem, you need to create two conversions:

  • UE (for downloading data from UP to exchange format)
  • BP (for loading data from the exchange format to BP)

Conversions are created in the section Conversions, team Conversions. For a new conversion, you must specify the name, configuration and exchange format. For example, conversion for the UE configuration:

  • Name& “UP2.0.7”.
  • Configuration& “Enterprise Management”.
  • Supported format versions& one line in which a single directory entry is selected Format versions.
  • data processing rules,
  • object conversion rules,
  • rules for converting predefined data.

To go to a set of rules for a specific conversion, you need to go to the section Conversions, select team Setting up conversion rules and select a specific conversion from the list for which the rules will be configured. As a result, the form will open Setting up exchange rules, which contains all the rules for a specific conversion.

Stage 3. Creating object conversion rules

Step 1. Conversion rule for unloading counterparties from the UE

  1. UP.
  2. Go to bookmark
  3. Basic information:
    1. Rule ID: “Directory_Counterparties_Dispatch”,
    2. Configuration object
    3. Format object: “Directory. Counterparties”,
    4. Application area: To send.
  4. Press the button Write down and go to bookmark Property conversion rules:
    1. Use the automatic property matching service
      1. Press the button Setting up PKS
      2. In the form that opens, click Automatch. The properties “TIN”, “KPP”, “Name”, “Full Name”, “Additional Information”, “LegalIndividual” will be compared.
      3. and close the form for setting up property conversion rules
  5. Press the button Save and close.

Step 2. Conversion rule for loading counterparties into the BP

  1. Open the exchange rules setting for conversion BP.
  2. Go to bookmark Rules for converting objects.
  3. Create a new conversion rule and fill in the data on the tab Basic information:
    1. Rule ID: “Directory_Counterparties_Receipt”,
    2. Configuration object: “DirectoryLink.Counterparties”,
    3. Format object: “Directory. Counterparties”,
    4. Application area: For getting.
  4. Press the button Write down and go to bookmark Identification. Specify the identification method “By unique identifier”.
  5. Go to bookmark Property conversion rules
    1. Use the automatic property matching service:
      1. Press the button Setting up PKS
      2. In the form that opens, click Automatch. The properties “TIN”, “KPP”, “Name”, “Full Name”, “Additional Information”, “LegalIndividual” will be compared.
      3. Save the result of automatic matching & press the button Create property conversion rules and close the form for setting up property conversion rules.
    2. Manually add a property conversion rule for OKPO (configuration property & “CodePoOKPO”, format property & “OKPO”).
    3. Later, you will need to return to the property conversion rules to populate the property conversion rule for the “LegalIndividual” property, which is an enumeration.
  6. Go to bookmark Before Recording the Received Data and write an algorithm to fill in the country of registration of a new counterparty. The algorithm contains next text: “Received Data.Country of Registration = Directories.Countries of the World.Russia;”.
  7. Press the button Save and close.

Stage 4. Creating rules for converting predefined data

  1. UP or BP)
  2. Go to bookmark Rules for converting predefined data
  3. Create a new conversion rule and fill in its properties:
    1. Rule ID: “Transfer_LegalIndividual”
    2. Configuration object: “TransferLink.LegalIndividual”
    3. Format object: “LegalIndividual”
    4. Application area: for sending and receiving
    5. In the table field, fill in the correspondence between the configuration and format enumeration values: “Individual” & “Individual” and “Legal Entity” & “Legal Entity”
    6. Press the button Save and close
  4. Specify a new rule in the conversion rule for the “LegalIndividual” property of the directory Counterparties
    1. Go to bookmark Object conversion rules
    2. Counterparties, open the rule form
    3. Go to bookmark Property conversion rules and find the rule for the property “LegalIndividual”
    4. Open the property conversion rule form and indicate in it the object conversion rule & “Transfer_LegalIndividual”.
    5. Save your changes

Stage 5. Creating data processing rules

The procedure is the same for both conversions.

  1. Open the exchange rules setting for conversion ( UP or BP)
  2. Go to bookmark Object conversion rules
  3. Find directory conversion rule Counterparties, open the rule form
  4. Press the button Create based on & Data Processing Rule
  5. In the created data processing rule, check the automatically filled properties:
    1. Rule ID& specify the same as for the data processing rule (“Directory_Counterparties_Sending” or “Directory_Counterparties_Receiving”)
    2. Application area& same as for data processing rule
    3. Sample object:
      1. for conversion UP& “DirectoryLink.Counterparties”
      2. for conversion BP& “Directory. Counterparties”
    4. Object conversion rule& link to the object conversion rule.
  6. Press the button Record and close.

Stage 6. Obtaining data exchange manager modules

The data exchange manager module is required to exchange data between configurations in accordance with those configured in KD 3.0 rules.

The procedure is the same for both conversions:

  1. Open information base UP or BP in the “Configurator” mode. Find a common module in the metadata tree Exchange Manager Through Universal Format and open it for editing. The module must be empty.
  2. Open information base KD 3.0 in Enterprise mode.
  3. Go to section Conversions and select a team Unloading the module.
  4. In the form that opens, indicate the appropriate conversion and click the button Unload. The module will be copied to the clipboard.
  5. Go to the infobase configurator UP or BP and paste the contents of the clipboard into the shared module Exchange Manager Through the Universal Format.
  6. Save the configuration.

The module can also be uploaded to the clipboard from the form for setting up exchange rules using the button Save exchange manager module.

In order for data to be exchanged according to the configured rules, it is necessary to configure data synchronization through a universal format in both information bases in the “Enterprise” mode.

Let's look at a simple real life example. Let's say we have a company that is engaged in wholesale and retail trade, and in this company, like in any other, accounting is done. The enterprise has two standard databases, these are UT (trade management) and BP (accounting of the enterprise), respectively, in each of the databases its own records are kept, in UT there is management to reflect all transactions related to trade, in BP there is accounting. In order not to do double work, i.e. do not create the same documents in two databases (after all, movements should be in management and accounting) we will just set up synchronization between these databases.

We will set up data exchange one-way, from UT ---> BP. It is also possible to set up a two-way exchange, but in practice this is not often required, so we will not consider it in our example.

Preparatory steps for setting up exchange in BP

Let's start setting up synchronization, first go to the 1C "Enterprise Accounting 3.0" database (receiver), we need to check whether synchronization is enabled for this database, in order to do this we need to first go to the database. As soon as the database opens, go to the tab "Administration" ---> "Data synchronization settings"

It opens before us new inset, it must be filled out in the same way as in the screenshot below, with the exception of the infobase prefix. The prefix must consist of two letters, you can set any, but according to the 1C standard it is better to set the prefix by the name of the configuration, that is, for “Enterprise Accounting” the prefix will be “BP”. If you are setting up complex exchanges and there are several accounting databases, then the prefixes should clearly differ from each other; here you can use the first two letters of the organization’s name as an abbreviation.

We continue setting up data synchronization in UT

After we've done everything necessary actions in the receiver database (BP 3.0), to continue setting up data exchange we need to open the source database (UT 11.1). Go to the "Administration" tab, select "Data synchronization settings" in the menu on the left. If synchronization is not enabled, then enable it using the checkbox, and do not forget to specify the source base prefix. Once we have completed all steps 1-4 as shown in the image below, you need to click on the “Data Synchronization” hyperlink (step 5).

In the new window that appears, you need to click on the green plus sign (Set up data synchronization), in the drop-down menu select the item “Enterprise Accounting 3.0”.

Setting up important points in data exchange between UT and BP

Now we see a window with settings for data synchronization in 1C, select “Specify settings manually” and click “Next”.

We continue to set up data exchange in 1C, on the next tab we need to select the option of connecting to the information base of the receiver (direct connection to the program), connection parameters (on this computer or in local network), the directory where the receiver database is located, as well as the necessary authentication data (username and password in the database).

On the next page we must fill in the rules for sending and receiving data from the BP 3.0 (receiver) configuration. Click "change data upload rules".

The “Rules for sending data” window has opened in front of us, in it we set the following parameters:

  • Which reference data will be sent (in our example, we are only interested in documents and the reference data used in them, so we selected the appropriate item; if you select the first item “Send all”, then all reference books will be reloaded along with the documents, often if the information is not used in the documents then it is useless for the receiver, because it does not affect the accounting in any way)
  • From what date should all information be sent (we will not consider manual synchronization in this article)
  • To which or which organizations to send data (in our example, we chose one organization, IP "Entrepreneur")
  • Rules for forming contracts
  • Generalized warehouse
  • Should I roll up documents by warehouse?

After we have made the settings, click “Save and close”.

Since in our example we set up and use one-way exchange, from UT to BP, then the settings for the rules for obtaining data from “Enterprise Accounting 3.0” are not of interest to us, so we click “Next”.

In a new window, we are asked to configure rules for the receiver base (RB). In point 1, we name our database, give it a prefix. The PREFIX must be the same as we set it in the BP database itself at the beginning of this article; if the prefixes are different, data synchronization in the 1C program will not work. After that, click point 2, and then point 3.

In paragraph 3, we need to allow documents to be processed when they are loaded into the database. Click "Save and close".

Now the window should look something like the one shown below, click “Next”.

This window contains reference Information about the created synchronization in 1C. Just click the "Next" button. If the program generated an error when setting up data synchronization, then you need to contact us so that our 1C specialist can help you right now!

Next step the program will offer to synchronize immediately after creating the data exchange settings. Let's agree to this and click "Done".

A window will appear in front of you in which you will see information about how the synchronization is proceeding. If the receiver base is not empty, i.e. records have already been kept in it, then the user in the 1C program will be asked to make a comparison of objects manually. Comparison of objects in 1C when synchronizing data is a comparison of identical objects of the receiver with identical objects in the source.

Let's look at an example, let's say in UT there is a counterparty with the name "PharmGroup LLC" and TIN 1234567, and in BP there is also a counterparty with TIN 1234567, but the name "PharmGroup", if we do not compare these two objects when comparing data at the synchronization stage, then after synchronization in the receiver (Enterprise Accounting 3.0), we will have two counterparties with TIN 1234567 and two names “PharmGroup LLC” and “PharmGroup”, respectively. In order to avoid such situations, a mechanism for comparing objects was invented.

In our example, the receiver database is empty, and therefore the object comparison window did not open. But after performing some operations, the system will definitely prompt the user to add some additional data and display the following window. We don’t need to transfer any additional data, we’ve already configured everything we need earlier, so at this step we select “Do not add documents to sending.” Click "Next".

The final stage of data exchange between 1C

At the final stage, the program will display the following window, in which the user will be informed that the synchronization was successful, click “Finish”. At this point, synchronization between databases in a one-way exchange from “Trade Management 11.1” (UT) to “Enterprise Accounting 3.0” (BP) is completed.

Each plan has a specific list of elements that it can store information about changes to. This list is called “Exchange Plan Contents.” The composition can be expanded, but configuration support is removed.

The “Plan Layout” stores the very rules on the basis of which synchronization works. It is precisely this conversion package (Registration Rules, Exchange Rules, Correspondent Exchange Rules) that we need for further study.

Let's consider an example of data synchronization between the configurations “1C: Salary and HR 3” (ZUP) and “1C: Enterprise Accounting 3” (BP). Let us note right away that in this task we will have to remove the configuration from support. This is required according to the condition.

A living example of the need for improvement standard rules exchange

For example, a customer contacted us with the following problem: when synchronizing between ZUP and BP, it is not possible to transfer the data from the “Registration with the tax authority” directory, which is necessary to fill out the document “Reflection of salaries in accounting.” Now tabular part of this document, on the receiver side, the BP contains an empty “Registration...” and users have to manually create such entries in the directory. Agree, this is inconvenient. We can improve this point.

Solution to the problem: let’s finalize the conversion package from the exchange plan ExchangeSalary3Accounting3. Let’s add to the standard “1C Exchange Rules” a new “Object Conversion Rule” (PKO) for the “Registration with the Tax Authority” directory and, accordingly, “Property Conversion” of this directory (PCS). We will definitely finalize the standard “Rules for registering objects”, because there was a need to register directory changes on the exchange site. And we will review the “1C Exchange Rules” of the correspondent’s database.

Where will we edit all this? To write and change the rules, we need the “1C: Data Conversion 2” configuration.

Finalization of standard conversion rules from the ZUP - BP Exchange Plan

So, we’ll start finalizing the 1C exchange rules by adding new element- Directory of Registration in the Tax Authority. We will make this change in both configurations “1C: Salaries and Enterprise Management 3” and “1C: Enterprise Accounting 3”.

Let's save and update the configurations.

In enterprise mode, for each database we will upload a description of the metadata structure using MD83Exp.epf processing for the 1C:Enterprise 8.3 platform. The processing can be found in the “1C: Data Conversion” package.

At the next stage, we will unload the conversion package from the ZUP and BP. The package must consist of 3 files: Registration Rules, Exchange Rules, Correspondent Exchange Rules.

This article will not describe how data synchronization is configured; you can read this on the Coderline website in the “Expert Articles” section or watch webinar recordings. Now this option is already configured in the databases. Therefore, go to the synchronization settings (Administration -> Data synchronization -> Data synchronization settings), click the “Load rules” button. The “Rules for synchronization” form will open in front of us. Click the “More” button and select the “Save rules to file” option.


This is the package we should get after unloading.

We will perform similar actions for another information base “1C: Enterprise Accounting”.
As a result, all the preparatory work for editing the rules is ready. We have:

Description of the metadata structure for loading into “1C: Data Conversion 2” (for ZUP and BP);

Conversion package, which contains 1C exchange rules and registration rules necessary for loading into “1C: Data Conversion 2” (for ZUP and BP).

Go to “1C: Data Conversion 2”. Let's perform the following steps in order for both infobases:

Loading the metadata structures of our configurations;

We create conversions and load 1C data exchange rules from conversion packages (the rules file is called ExchangeRules);

We create registrations and load registration rules from conversion packages (the rules file is called RegistrationRules).


Let's move on to our revision. We are adding a new object conversion rule (PKO) to the 1C exchange rules - the “Registrations with the tax authority” directory. We add a property conversion rule (PCR) for this directory and a data upload rule (DRU). This kind of modification must be performed both for the rules from the ZUP package and for the exchange rules from the BP package. We upload our exchange rules to the corresponding ExchangeRules files.

Let's move on to the rules for registering a new element. We are adding a reference book “Registrations with the tax authority”. We upload the registration rules to the appropriate file from the RegistrationRules package. We also perform this action for both databases.

The revised exchange rules and registration rules are ready. Now we copy the contents of the exchange rules (ExchangeRules) from the BP package into the correspondent rules (CorrespondentExchangeRules) from the ZUP package. In the correspondent rules (CorrespondentExchangeRules) from the BP package, we copy the contents of the exchange rules (ExchangeRules) from the ZUP package.

The result should be the following:

This completes the work in “1C: Data Conversion 2”. The modified packages of conversion rules are ready, all that remains is to upload them back to the information databases and check the synchronization.

Archive files from packages to ZIP archive and load our conversion packages into the ZUP and BP.

All is ready. It remains to be tested.

Let us recall the conditions of the problem. It was necessary to register the “Registration with the tax authority” directory for downloading and check how the TC of the document “Reflection of wages in accounting” is filled out on the “1C: Enterprise Accounting 3” side.

In the source “1C: Salaries and Enterprise Management 3” we register our directory for downloading. We perform synchronization. We go to the receiver database and also perform synchronization to receive data. Please note that now the exchange plan has the necessary directory for registering changes.

We check on the “1C: Enterprise Accounting 3” side:


Summarize. The result of the task was completed successfully. We have finalized the ZUP - BP exchange plan, adding a new element for registering changes and added conversion rules for data synchronization.

Data exchange between 1C 8 application solutions is something without which it is not possible to build a full-fledged information space enterprises.

  • Why are data exchanges needed and how to use them?
  • Types of exchanges between 1C.
  • How to configure data exchange between 1C databases?

You will find out the answers to these questions below.

There are usually two reasons for introducing exchanges:

The organization has a branch network

In this case, you simply need to set up the exchange between different branches. For this purpose, there is a mechanism in the 1C 8.3 Enterprise system. With which you can flexibly configure the exchange of information. For example, for branches you can disable the visibility of documents for other branches and at the same time the central office will see documents of all branches. Another example is setting up an exchange between the 1C Retail databases of an office and stores.

Separation by type of accounting

As a rule, this means that the organization maintains different records in different information databases. This separation allows you to filter information that is “unnecessary” for another type of accounting for various information bases. Example: so-called “Management accounting” will be entered into the “Trade Management” database, where all transactions are reflected, and management sees the full picture of events, and only the documents necessary for accounting and tax accounting are uploaded to the regulated accounting database “Enterprise Accounting”.

What are the exchange mechanisms between 1C databases?

Data exchanges can be classified in two ways: the mechanisms used and the transport used for the exchange.

1C data exchange mechanisms

Typically, two mechanisms are used for exchange:

  • Distributed information base(RIB)— a mechanism that allows you to set up data exchange between branches. The mechanism implies that absolutely identical database configurations are exchanged. The mechanism can transfer database configuration changes. The mechanism is implemented at the technology platform level.
  • A universal mechanism for exchanging between configurations— the mechanism is developed by 1C for application solutions. It is universal and based on . Data exchange is carried out using xml rules, which are created in a special configuration - . Using this mechanism, you can implement both one-time exchange and constant exchange between 1C configurations. The mechanism is implemented at the configuration level; you can integrate it into your configuration from the technological configuration.

Transport for data exchange

Transport can be a fairly wide range of technologies. Let's consider the main ones implemented in the universal exchange mechanism 1C 8.2:

Get 267 video lessons on 1C for free:

  • Local or network directory- the simplest transport. One information security creates a file on disk, the second reads it and adds its own file.
  • FTP resource— exchange is similar to exchange through a catalog. The difference is that the exchange is carried out via the FTP protocol.
  • Postal messages or E-mail- the exchange takes place within means Email. The configurations send mail messages to each other and regularly check the mail address for new messages.
  • Direct connection (COM)— the exchange is carried out through a direct connection of one database to another using funds.
  • Internet (Web service)— the transport is a web service. One infobase connects to , the web service connects to the second infobase and transports the message. To carry out such transport you must have.

How to set up data exchange between 1C databases?

For the basics of setting up data exchange in 1C using the “1C Data Conversion” configuration, see the example in the video:

1C data exchange according to schedule in 1C 8.2

If you need to configure automatic uploading on a schedule, just configure .

For client-server version

In the “Data exchange settings” directory, on the “Automatic exchange” tab, you need to create a new routine task, where to specify the schedule:

For file option

In the “Data exchange settings” directory, on the “Automatic exchange” tab, you need to create a new routine task, where, on the “Exchange by events” tab, specify the events on which the exchange will be launched. For example, when a specific user starts: