Environment Functions

Session identifiers

Data status indicators within a session

About Environment Functions

You use the $ENV Environment Function in the Mapping Rules to access run-time information about the current session:

  • Session identifiers:provide the names and identifying numbers of the objects used in the current session
  • Data status indicators within a session: retrieve information on Input-Event processing in a batch or a Transformation-Phase.

Session identifiers

The following table summarizes the Session identifier functions available within AccountingIntegrator Enabler.

Function Returns

$ENV("EVTCODE")

Name of the Input-Event

$ENV("SEGCODE")

Name of the segment

$ENV("SEGSTRUC")

Name of the output Business-Document

$ENV("DOMAIN")

Name of the Transformation-Domain

$ENV("ENDDATE")

End validity date of the Transformation-Rule

$ENV("GROUP")

Batch code

$ENV("INSTANCE")

Instance code

$ENV("NUMSC")

Financial-Case number

$ENV("NUMSCSEG")

Financial-Case and Output-Event numbers (in this order)

$ENV("NUMSEG")

Output-Event number

$ENV("NUMSEGSC")

Output-Event and Financial-Case numbers (in this order)

$ENV("PHASE")

Name of the Transformation-Phase

$ENV("VERSION")

Input-Event version

$ENV("RULE")

Name of the Transformation-Rule

$ENV("SENDER")

Code of the Processing-Context-In

$ENV("STARTDATE")

Start validity date of the Transformation-Rule

Data or status indicators within a session

Function Indicates

$ENV("FIRSTGROUP")

First Input-Event in the batch

$ENV("FIRSTPHASE")

First application of the Rule in the Transformation-Phase

$ENV("LASTGROUP")

Final Input-Event in the batch

$ENV("LASTPHASE")

Final application of the Rule in the Transformation-Phase

$ENV("EVTCODE")

Description

$ENV("EVTCODE")

Syntax

$ENV("EVTCODE")

Return

Name of the processed Input- Event. The target field must be A(25) - Alphanumeric and 25 characters long.

Parameters

None.

Example

The following example writes the name of the processed Input-Event into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("EVTCODE")

$ENV("SEGCOD")

Description

$ENV("SEGCODE")

Syntax

$ENV("SEGCODE")

Return

Name of the processed segment type. The target field must be A(25) - Alphanumeric and 25 characters long.

Parameters

None.

Example

The following example writes the name of the processed segment type into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("SEGCODE")

$ENV("SEGSTRUC")

Description

$ENV("SEGSTRUC")

Syntax

$ENV("SEGSTRUC")

Return

Name of the Business-Document in the generated Output-Event. The target field must be A(3) - Alphanumeric and three characters long.

Parameters

None.

Example

The following example writes the name of the Business-Document in the generated Output-Event into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("SEGSTRUC")

$ENV("DOMAIN")

Description

$ENV("DOMAIN")

Syntax

$ENV("DOMAIN")

Return

Name of the Transformation-Domain activated for the session. The target field must be A(25)- Alphanumeric and 25 characters long.

Parameters

None.

Example

The following example writes the name of the Transformation-Domain for the current session into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("DOMAIN")

$ENV("ENDDATE")

Description

$ENV("ENDDATE")

Syntax

$ENV("ENDDATE")

Return

End validity date of the applied Rule and period. The target field must be D(7) - Date Data Type and seven characters long.

Parameters

None.

Example

The following example writes the end validity date for the applied Rule into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("ENDDATE")

$ENV("GROUP")

Description

$ENV("GROUP")

Syntax

$ENV("GROUP")

Return

Group code of the processed Input- Event. The target field must be A(34)- Alphanumeric and 34 characters long.

Parameters

None.

Example

The following example writes the group code of the processed Input-Event into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("GROUP")

$ENV("INSTANCE")

Description

$ENV("INSTANCE")

Syntax

$ENV("INSTANCE")

Return

Instance code of the processed Input-Event. The target field must be A(34)- Alphanumeric and 34 characters long.

Parameters

None.

Example

The following example writes the name of the processed Input-Event into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("INSTANCE")

$ENV("NUMSC")

Description

$ENV("NUMSC")

Syntax

$ENV("NUMSC")

Return

Number assigned to the executed Financial-Case. The target field must be N(2) - Numeric and two characters long.

Parameters

None.

Example

The following example writes the number assigned to the executed Financial-Case into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("NUMSC")

$ENV("NUMSCSEG")

Description

$ENV("NUMSCSEG")

Syntax

$ENV("NUMSCSEG")

Return

Numbers assigned to the executed Financial-Case and the generated Output-Event. The target field must be N(4) - Numeric and four characters long.

Parameters

None.

Example

The following example writes the numbers assigned to the executed Financial-Case and the generated Output-Event into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("NUMSCSEG")

$ENV("NUMSEG")

Description

$ENV("NUMSEG")

Syntax

$ENV("NUMSEG")

Return

Number assigned to the generated Output-Event. The target field must be N(2) - Numeric and two characters long.

Parameters

None.

Example

The following example writes the number assigned to the generated Output-Event into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("NUMSEG")

$ENV("NUMSEGSC")

Description

$ENV("NUMSEGSC")

Syntax

$ENV("NUMSEGSC")

Return

Numbers assigned to the generated Output-Event and the executed Financial-Case. The target field must be N(4) - Numeric and four characters long.

Parameters

None.

Example

The following example writes the numbers assigned to the generated Output-Event and the executed Financial-Case into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("NUMSEGSC")

$ENV("PHASE")

Description

$ENV("PHASE")

Syntax

$ENV("PHASE")

Return

Name of the Phase in progress. The target field must be A(25)- Alphanumeric and 25 characters long.

Parameters

None.

Example

The following example writes the name of the Phase in progress into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("PHASE")

$ENV("RULE")

Description

$ENV("RULE")

Syntax

$ENV("RULE")

Return

Name of the applied Rule. The target field must be A(5)- Alphanumeric and five characters long.

Parameters

None.

Example

The following example writes the name of the applied Transformation-Rule into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("RULE")

$ENV("SENDER")

Description

$ENV("SENDER")

Syntax

$ENV("SENDER")

Return

Name of the Processing-Context-In for the session. The target field must be A(25)- Alphanumeric and 25 characters long.

Parameters

None.

Example

The following example writes the name of the Processing-Context-In for the session into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("SENDER")

$ENV("STARTDATE")

Description

$ENV("STARTDATE")

Syntax

$ENV("STARTDATE")

Return

Start validity date of the applied Rule. The target field must be D(7) - Date Data Type and seven characters long.

Parameters

None.

Example

The following example writes the start validity date of the applied Transformation-Rule into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("STARTDATE")

$ENV("VERSION")

Description

$ENV("VERSION")

Syntax

$ENV("VERSION")

Return

Version number of the processed Input-Event. The target field must be N(3) - Numeric and three characters long.

Parameters

None.

Example

The following example writes the version number of the processed Input-Event into a Business-Document field named REF_INST.
 

Target field

Mapping Rule

REF_INST

$ENV("VERSION")

$ENV("FIRSTGROUP")

Description

$ENV("FIRSTGROUP") indicates whether the current Input-Event is the first in the group being processed.

Syntax

$ENV("FIRSTGROUP")

Return

The value returned is either "1" or "0" (zero), depending on whether the condition is correct or incorrect:

  • 0: The Input-Event processed is not the first in the group processed
  • 1: The Input-Event processed is any the following:
    • first in the group processed
    • the only Input-Event in the group processed
    • does not belong to a group

The target field must be A(1) - Alphanumeric and one character long.

Parameters

None.

Example

The following example creates a Mapping Rule to generate an Output-Event only if the current Input-Event is the first in the group being processed (or does not belong to a group).
 

Target field

Mapping Rule

Output-Event generation condition

$ENV("FIRSTGROUP") = "1"

$ENV("FIRSTPHASE")

Description

$ENV("FIRSTPHASE") indicates whether the current Input-Event is the first in the Phase being processed.

Syntax

$ENV("FIRSTPHASE")

Return

The value returned is either "1" or "0" (zero), depending on whether the condition is correct or incorrect:

  • 0: The Rule is not applied for the first time in the current Phase (irrespective of the segment type processed)
  • 1: Either of the following:
  • The Rule is applied for the first time in the current Phase (irrespective of the segment type processed)
  • The Input-Event is mono-segment and it is processed by a mono-Rule Phase

The target field must be A(1) - Alphanumeric and one character long.

Parameters

None.

Example

The following example creates a Mapping Rule to generate an Output-Event only if the current Input-Event is either mono-segment or is being processed for the first time in the current Phase.
 

Target field

Mapping Rule

Output-Event generation condition

$ENV("FIRSTPHASE") = "1"

$ENV("LASTGROUP")

Description

$ENV("LASTGROUP") indicates whether the current Input-Event is the last in the group being processed.

Syntax

$ENV("LASTGROUP")

Return

The value returned is either "1" or "0" (zero), depending on whether the condition is correct or incorrect:

  • 0: The Input-Event processed is not the last in the group processed
  • 1: The Input-Event processed any the following:
  • last in the group processed
  • the only Input-Event in the group processed
  • does not belong to a group

The target field must be A(1) - Alphanumeric and one character long.

Parameters

None.

Example

The following example creates a Mapping Rule to generate an Output-Event only if the current Input-Event is not the last in the group processed.
 

Target field

Mapping Rule

Output-Event generation condition

$ENV("LASTGROUP") = "0"

$ENV("LASTPHASE")

Description

$ENV("LASTPHASE") indicates whether the current Input-Event is the last in the Phase being processed.

Syntax

$ENV("LASTPHASE")

Return

The value returned is either "1" or "0" (zero), depending on whether the condition is correct or incorrect:

  • 0: The Rule is not applied for the last time in the current Phase (irrespective of the segment type processed)
  • 1: Either of the following:
  • The Rule is applied for the last time in the current Phase (irrespective of the segment type processed)
  • The Input-Event is mono-segment and it is processed by a mono-Rule Phase

The target field must be A(1) - Alphanumeric and one character long.

Parameters

None.

Example

The following example creates a Mapping Rule to generate an Output-Event only if the current Rule is not being applied for the last time in the current Phase.
 

Target field

Mapping Rule

Output-Event generation condition

$ENV("LASTPHASE") = "0"

Back to top

Related Links