1C:ENTERPRISE 8.2. A Practical Developer's Guide
Examples and Standard Techniques
Maxim RADCHENKO, Elena KHRUSTALEVA. Moscow, 2010
This book is a guide that support rapid assimilation of techniques for developing and adapting applications using the 1C:Enterprise 8.2 software
On the basis of examples from an actual application, it demonstrates the structure of various system objects, their functions and usage. Procedures written in the built-in language, including those that involve the query language, are supplied with detailed comments.
The book can be used both as practical guide and as a reference book. The applied solution used in this guide takes into account the accumulated experience of developing in 1C:Enterprise software and demonstrates many new possibilities and mechanisms provided by the version 8.2 of the software.
The guide is destined to beginning developers who are unfamiliar with 1C:Enterprise software.
Brief Table of Contents
- Lesson 1 (0:40). Introduction, Creating an Infobase.
- Lesson 2 (00:45). Subsystems.
- Lesson 3 (02:10). Catalogs.
- Lesson 4 (01:30). Documents.
- Lesson 5 (02:00). Theoretical Lesson.
- Lesson 6 (00:50). Accumulation Registers.
- Lesson 7 (00:25). Simple Report.
- Lesson 8 (01:10). Templates. Editing Templates and Forms.
- Lesson 9 (00:50). Periodic Information Registers.
- Lesson 10 (00:30). Enumerations.
- Lesson 11 (01:20). Posting a Document across Multiple Registers.
- Lesson 12 (00:40). Turnover Accumulation Registers.
- Lesson 13 (04:30). Reports.
- Lesson 14 (03:20). Optimization of Posting the Services Rendered Document.
- Lesson 15 (02:50). Chart of Characteristic Types.
- Lesson 16 (01:50). Accounting.
- Lesson 17 (01:00). Chart of Calculation Types, Calculation Register.
- Lesson 18 (03:40). Using a Calculation Register.
- Lesson 19 (01:30). Database Search.
- Lesson 20 (01:00). Executing Scheduled Jobs.
- Lesson 21 (00:40). Editing Register Records in the Document Form.
- Lesson 22 (01:00). User List and Their Roles.
- Lesson 23 (01:10). Desktop and Command Interface Setup.
- Lesson 24 (06:10). Data Exchange.
- Lesson 25 (00:30). Functional Options.
- Lesson 26 (01:00). Choices and Input on Basis
- Lesson 27 (02:10). Techniques of Form Development
- Developer's Quick Reference.
This book is prepared specifically for release of the final version of the 1C: Enterprise 8.2 platform.
1C: Enterprise 8.2 is a radical change of the architecture in the platform of the 8th version that is most significant since its initial release.
The book that you are now reading has two major advantages.
On the one hand, it describes all the major features that are mostly important for development in the new 1C: Enterprise 8.2 platform version: designing of managed interface, development of managed forms, using report variants and new opportunities of their settings, new method of posting documents, settings of desktop, command interface, using functional options, etc.
On the other hand, the book has received modifications and additions to address the specialists who are not familiar with 1C: Enterprise 8. To do so, we have used the questions, opinions, and feedback shared by the readers in the online forum.
For example, the book now has a dedicated section for the method of using Syntax Assistant and various ways of using the debugger to analyze the existing code and develop your own code. This information will certainly help novice developers in learning numerous features of the 1C: Enterprise 8.2 script.
Also the book demonstrates examples of limiting access rights at the level of records and fields of the database. Such examples were not available in the previous revisions of this book.
The previous revisions of this book were very successful among 1C: Enterprise 8 developers. This book enabled dozens of thousands of developers to learn versions 8.0 and 8.1 of the 1C: Enterprise platform. The entire circulation of the previous revisions amounted to more than 60 thousand copies.
The authors hope that this book will be useful for everyone intending to develop applications on the new 1C: Enterprise 8.2 platform.
Maxim Radchenko, Elena Khrustaleva
Target Audience of the Book
The book is based on a real example of developing an application for a small-sized company working in the field of personal services. In the process of going through the book, you will learn major methods of development in the 1C: Enterprise 8, various fields of automating economical activities, including accounting, payroll, etc.
Why have we picked this particular example?
On the one hand, most of us are familiar with the service sector. One way or another, we are constantly running into various services. Such services include home appliance repair, auto service, laundry and dry cleaning, hair stylists and beauty consultants, and many more.
On the other hand, the activities in a maintenance business lend themselves to a demonstration of the capabilities in the 1C: Enterprise 8. Here you find a range of customer services, the need to supply the company with the required materials, and expenses in the process of providing services. Operations of such a company allow us to look at human resource management and payroll management. We can also illustrate the accounting process. Due to this broad range of activities, we can offer broad demonstration of the capability to create various account statements and summary reports using the information on hand.
This book is intended mostly for the novice developers who are only beginning to develop their applications. The explanations in the book are detailed enough and understandable even for those readers who only know the very basics of programming.
If you are only beginning to operate 1C or are not familiar with it at all but are willing to master the system, the book is intended for you. The goal of the book is to take you step by step through the major stages of development of an application in 1C: Enterprise 8 and to demonstrate that everything is possible for a human being.
This book will also be useful for more experienced developers because it will help them refresh their skills or learn some specifics of the development in details.
How to Read This Book
This book is as close as possible to a tutorial and includes individual lessons. In the beginning of every lesson we provide an estimated timing for you to understand how much time on average you will need to spend on this lesson.
Lessons are finalized with a quiz enabling you to test your knowledge.
The book has a brief table of contents listing the lessons and their duration. The lessons themselves include more detailed tables of contents that will help you to quickly navigate to specific sections of the previous lessons. A detailed table of contents for all the lessons is located in the end of the book.
Every lesson is a complete part of an application development. Hence, while the lessons have different durations, we recommend completing every lesson in full, from the beginning to the end. Otherwise as a novice developer you may face difficulties in restoring your activities from some point in the middle of a lesson.
The lessons are built with more difficult issues following less difficult ones. The lessons describe major methods and various fields of development in the 1C: Enterprise 8 step by step.
The book includes numerous figures and samples of the 1C: Enterprise script code accompanied by detailed explanations. If such explanations seem to be unnecessary or too detailed, you can skip them.
The lessons also include parts of theory that you can either read while you work with a lesson or leave for later. Whatever you choose, it will not influence execution of the development example that is covered in the book.
The special theoretical lesson No. 5 covers examples of working with the debugger and the Syntax Assistant in details. This will help you to further learn the 1C: Enterprise script on your own and deal with the errors that can be possible when you work on the tasks.
The configuration that is created in the book, is stored in a demo infobase on an accompanying CD. You may use this configuration when you need to check if you execute the examples in the book correctly.
Since the example studied in the book is quite large, the CD contains four infobases instead of the only one. These infobases correspond to completing lessons 8, 13, 20, and 27. This will help you to quickly find the configuration fragments you need.
We would like to thank Veronica Korsakova who has become the first reader of this book and tested its materials as a person without experience in programming.
Her feedback and notes have made this book better understandable and accessible for inexperienced readers.
The book is accompanied by a CD with materials for individual learning and use.
These materials include four configurations that correspond to the state of the developed application as of completing the respective chapters.
All the demo configurations are stored on the CD as a single distribution kit. When you run the executable file, the configuration templates are installed to the current template directory. These configurations have been developed in the 1C: Enterprise version 18.104.22.1686.
These configurations are not exactly objectively completed applications and are not intended for real-life accounting purposes. They are merely a set of examples intended to explain the content of the book.
The CD also contains all the listing fragments that are included in the book. These fragments may be useful both when you read the book and in subsequent work. This is why we have arranged the fragments as a template file of the 1C: Enterprise 8 code - Templates.st.
You can connect this file to any configuration using Tools>Text Templates>Actions>Template Setup>Add commands (fig. 0.1).
The fragments of code are grouped by lessons (fig. 0.2).
Every code fragment includes a line sequence that is the listing number with the respective code fragment and is replaced when you enter some text. The line sequence can be replaced automatically if autoreplace mode is enabled or manually using Ctrl + Q keyboard shortcut. The autoreplace mode is enabled using Tools>Options>Module Texts>Autoreplace. Also any text template can be simply dragged and dropped to an arbitrary location in a module.
The CD also includes a folder named Image that stores the files of images used to create configuration subsystems.
Fig. 0.1. Connecting Templates
Fig. 0.2. Templates of Listing Texts
Limitations of the Platform Training Version
This book may be sold independently or included in the 1C: Enterprise 8.2. Version to Teach Programming.
The independent book is not accompanied by the 1C:Enterprise 8.2 platform. We assume that you already own one of the 1C:Enterprise 8.2
products that enables you to modify (customize) applications. It is possible in most of the 1C: Enterprise 8.2 software products. The only exception is basic versions.
If you receive this book included in the 1C:Enterprise 8.2. Version to Teach Programming, this product includes a training version of the 1C: Enterprise 8.2 platform. You can use it if you do not own any other 1C: Enterprise 8.2 products.
The training version of the platform has some limitations that will not allow for full execution of the examples in the book. Such limitations are not numerous or fundamental. But they should be specified anyway.
Lesson 24 covers data exchange. The training version of the platform will not allow to test operation of the second part of the example, the distributed infobase. But you will be able to fully study the first, more general part (universal exchange mechanism).
Lesson 20 covers scheduled jobs. The training version of the platform does not support launching two sessions simultaneously: one for the job scheduler and the second one for a normal user session. But you can run them in succession to make sure that they both operate correctly.
In lesson 22 you create a list of the system users. Training version of the platform will not allow to create passwords for the users and does not support enabling authentication using operating system tools. But this is not vital to study this aspect because you will still be able to run the software on behalf of every created user. But the users will not have passwords.