Use this function to set up sequence numbers to be used throughout the system.

Each sequence number counter is identified by an alphanumeric code. You use this function to define the structure of each sequence number counter to suit your organization. Once you have defined the structure of your sequence numbers you use the sequence number Assignment function (GESTCA) to assign the sequence number to a specific type of document.

For example, your organization produces sequentially-numbered quotations from different sites, each prefixed with the site code. You use this function (Structures) to create a sequence code for each individual site such as SQSA, SQSB, SQSC (where SQ represents Sales quotation, and SA, SB and SC represent site A, site B and site C respectively), each with a numerical sequence number component and a site code prefix. Having defined the components that make up the structure of each sequence code you use the Assignment function to assign the appropriate sequence code to the document type Quote for each site or company.

The maximum length permitted for the combined components that make up each sequence code structure is displayed. Your structure can use fewer characters but you must not exceed the maximum permitted length.

Each sequence code must be unique, however multiple document types can be assigned the same sequence code. You must ensure, therefore, that you do not duplicate the structure for document types that must have unique keys as this can result in the cancellation of a transaction.

You can set the sequence number start value either by selecting the Reset to zero check box (ZERO) or you can use the Sequence number values function (MODCPT) to set the start value for each component of the counter. This function is particularly useful should data recovery be actioned as you can define the next chronological number for a system restart.

Sage advises that the Sequence number values

Prerequisites

SEEREFERTTO Refer to documentation Implementation

Screen management

The Structures function comprises a single tab subdivided into key elements of the sequence code.

Entry screen

Each block represents a key element that you must define for your sequence code. The Components block, however, is variable. You use this block to define the components that make up the structure of the sequence number for your organization.

Component type

Explanation

Constant

Fixed character string. The value must be entered in the Formula column. Do not use single or double quotes around the value.

Year

Length = 1 represents the last number of the year (0 - 9).
Length = 2 represents the last two numbers of the year (00 - 99).
Length = 4 represents the full year.

Month

Length = 2 represents the month as a number (00 - 12).
Length = 3 represents the first three characters of the name of the month in English (JAN, FEB, MAR etc.).

Week

Length = 2 represents the week number (00 to 53).

Day

Length = 1 represents the day in the week as a number (1 - 7).
Length = 2 represents the number of the day in the month (01 - 31).
Length = 3 represents the number of the day in the year (001 - 366).

Company

Company code to which the transaction is assigned (in one to five characters).

Site

Site code to which the transaction is assigned (three characters).

Sequence number

Incremental part of the sequence number structure. This value increments by 1. The initial value is 1.

Complement

Additional component. The value depends on the module that is using the sequence number component.

Fiscal year

The fiscal year number is defined using one to three digits (for the first open fiscal year the value is equal to 1). The value of this component is evident where there are offset fiscal years. When this situation occurs there is a break in the number when the year changes. This can occur in the middle of a fiscal year.

Period

The period number is represented by one to three digits (starting with 1, up to the maximum number of periods in a fiscal year).

Formula

Used to insert a formula into the sequence number structure. This is essentially an independent series of characters inserted into the generated sequence number. The formula can be alphanumeric, a number or a date, and up to a maximum of 20 characters. Note that alphanumeric characters are converted to uppercase and then formatted to the exact number of planned characters.

Important information

Additional field

The additional field code is used to define a sequence number segment depending on the context, without having to define two sequence number counters. It is important to understand that in this situation there is a chronological sequence for each different value stored by the additional field code.

Using the additional field code depends on the context used for each function.

For the Supervisor functions the additional field code can be used for the sequence number counter of the lot numbers in the import-export temporary storage space. It contains the code of the import-export template being used.

A list of the additional field codes used in the business modules is defined in the attached documentation.

In all other cases, the additional field number is not assigned. You can however use a dedicated entry point to give a specific value to the additional field number in a given context.

You can integrate the additional field code in a numbering sequence without using a different sequence by counter value. In order to achieve this you must include the Formula component type with the formula [L]ADDITIONAL FIELD (ADDITIONAL FIELD) as the local variable known to the number sequence subprogram that stores the current value of the additional field.

Sequence types

The Sequence type can be important for customer installations with a large number of workstations that create a large number of a given type of document. According to the sequence type that is used there can be transactional conflicts linked to obtaining numbers from the sequence number counters.

Normal counter: Use

The allocation of the number, usually when creating a document (order, posting, invoice, etc.), is carried out in the creation transaction itself. This means that the number will not be lost in the event a transaction is cancelled by a rollback. As long as the creation transaction (which can last several seconds) is not completed all concurrent creation transactions will fail for the same type of document as they cannot obtain a number. A rollback of the concurrent transaction will be carried out followed by a new attempt (that starts if the first transaction is completed).

The number of successive attempts carried out as a result of this type of lock before cancellation of the transaction on error can be set up using the ROLLBACK definition from the SUP chapter. Should a conflict occur the value of this definition can be increased. You must be aware, however, that consumption of data server resources can increase to the detriment of performance. You can adjust the sequence type to improve this.

Conversely, the normal sequence number counter guarantees the respect of sequential order in time: Two successive calls in time to a given sequence number counter will provide incremental numbers, all conditions linked to the structure of the sequence number counter (company, site, period, supplement) being equal. In addition, no number loss relative to the lock can occur. This type of sequence number counter is therefore recommended for legal documents for which strict sequences with no number sequence "gaps" are demanded.

Grouped counter: Use

The numbers are allocated using a group of N numbers (where N is a definition). Contention is therefore less important because only an assignment to N can cause a contention with the other assignments using an available number.

Conversely, the sequential assignment of numbers is not guaranteed, and a loss of numbers is possible for the sequence number counter depending on the month or the period. For example, where N is equal to 10, the number 1 to 8 is already assigned and 3 creation transactions are in process. The first will be assigned to the number 9, the second to number 10, the third cannot find an available number in the first group of 10 numbers. The range 11 to 20 will then be created which will lead to the first available number being assigned as 11. If in the meantime the first transaction fails for other reasons, the number 9 will become available for a new transaction. If no further transaction is started the situation arises where all the numbers between 1 and 11, excluding 9 are used, and where the next numbers to be assigned will be (in order) 9, then 12 etc. Therefore there is not a strict adherence to the number sequence. If no other document creation takes place during a day, and if a document is created the next day, there will be a document dated for day D numbered 11 and a document dated for D+1 numbered 9. Finally, if the sequence number counters contain the number of the month and this situation occurs at the end of the month, there will be a gap in the number sequence (but it is possible to trace this as the number is found in the list of numbers to be assigned).

Database sequence counter: Use

The number assignment is made outside of the transaction, that is, there is no contention, but no backward return is possible (if the number is not used it is permanently lost). This type of sequence number counter relies on the database sequence. Safe X3 creates, for each table in the database, a sequence that is normally associated with it to obtain a technical number. It is important to note that this numbering is never reset to 0 (therefore you must plan for a large number of digits associated with the numbering sequence in the serial number sequence). It is also strictly sequential (the order of assigned numbers always increases), however it is possible to have gaps in the sequence without either justifying or recovering them. This characteristic is used from the moment there is a need for a unique technical number, for which no justification for gaps in the sequence is necessary.

Sequence type: Summary

The advantages and drawbacks of the different types of sequence number counters are summarized in the following table:

Type of sequence number counter

Increasing sequence

Number loss

Multi-user conflicts

Normal

Always

Never

Strong

Grouped

Not always

At the end of the period, but justifiable (list of lost numbers)

Average (more reliable when N is large)

Database sequence

Always

Yes, without justification

Nil

Actions spécifiques

Copy

Click the Copy action to copy this sequence code and structure to a different folder.

Error messages

In addition to the generic error messages, the following messages can appear during the entry :

2 sequence numbers

An attempt has been made to define a sequence number series with two components of the type Sequence number (a single sequence number is authorized by the sequence number series).

Incorrect value

The length requested is not compatible with the definition (for example, a year with 8 digits or a month with 5 characters).

Length too great

The total length of the sequence number series exceeds 20 characters, or the sum of the lengths of the components is different to the total permitted length.

Incorrect expression / Illegal character

The calculation formula that has been entered has an incorrect syntax.

Table type: system:

A counter based on a sequence relies on a table existing in the current folder. This is not the case for this type of table.

Sequence type possible at folder levelSequence type authorized without RTZ

A counter based on a database sequence can only allow one numbering sequence (therefore at folder level) and cannot be reset to zero.

Tables used

SEEREFERTTO Refer to documentation Implementation