This function is used to define automatic journal variables that can be used in the automatic journal line formulas.

The use of a variable in a formula can be useful whenever initializing a field in an entry line is complex and cannot be reduced to a simple expression. In that case, calling a variable will translate into a call to a sub-program that will evaluate the variable and allow the generator to initialize the content of the accounting line field.

Setup of the automatic journal variables

Each automatic journal variable is associated with a code that can be used in any automatic journal line.

Calling a variable in a formula will translate into a call to a sub-program defined in a processing where the names are to be set up in the dedicated fields.

Each variable :

  • Can contain a certain number of 'by value' parameters required to evaluate the variable (these variables will be transmitted to the sub-program as parameters).
  • Must necessarily contain a 'by address' parameter. This parameter corresponds to the result of the variable evaluation.
  • Returns a variable of integer type used to define an error code, in addition to the evaluation parameter. This parameter need not be defined in the parameter list, but it is automatically added in the call to the sub-program : the sub-program code must therefore include it.

For instance:

In certain automatic journal lines, it is necessary to know the VAT rate to be applied based on the tax code, the accounting date and the company. The 'VAT' variable has been added in standard to allow the evaluation of the tax rate and contains the following parameters:

  • Three 'by value' parameters required for the tax rate evaluation: the company (CPY) of 'Char' type, the tax code (TAX) of 'Char' type, the date (DAT) of 'Date' type
  • One 'by address' parameter corresponding to the desired result: the tax rate (VATRAT) of 'Decimal' type

Prerequisites

SEEREFERTTO Refer to documentation Implementation

Screen management

Entry screen

Setup principle in the formulas

Each variable can be used in the grid of the formulas associated with the entry line fields via the V_XXXXX syntax (XXXXX being the variable code). Entering a variable triggers a window where the user must indicate the value of each parameter required for the variable evaluation (parameter of 'Value' type). The value specified for each parameter must be of the correct type.

Note that the parameters transmitted during the call to the sub-program can be constants, variables or complex expressions that include in line variables.

The reference to a variable on an automatic journal line generates the call to the sub-program in question in the WMGAUYYYYY processing (YYYYY being the automatic journal code) using :

  • The variable parameters in the order in which they have been entered in the automatic journal variable setup.
  • A 'STAT' parameter of the 'Integer' type that can be used to send a return status to the automatic journal generator. If the STAT variable is equal to 98 upon return, the automatic journal will not be generated and the error displayed will be the one contained in the GMESSAGE global variable.

In addition, note that in the processings generated upon posting of the automatic journals, the main table is open under the [F:TB0] abbreviation instead of its own abbreviation. As for the line table, it is open under the [F:TB1] abbreviation. This does not impact the formulas entered or the parameter expressions passed to the automatic journal setup. The usual abbreviations of the main tables can still be used because the validation of the automatic journal automatically replaces the abbreviations in the expressions. However, if the processing called by the variable must call on fields of the main table or of the line table for the current record (if for example, the processing tests fields in these records that have not been passed as argument), the [TB0] and [TB1] abbreviations must be used in the processing.

Specific Buttons

Copy

Error messages

The only error messages are the generic ones.

Tables used

SEEREFERTTO Refer to documentation Implementation