Publish does not create new object variables

Document ID : KB000084524
Last Modified Date : 14/04/2018
Show Technical Document Details
Issue:
Error Message :
N/A

Publish does not work unless the Object variable is created or defined before the function is called.

The product documentation states:

The script statement :PUBLISH converts a script variable or a script array to an object variable and, if required, it passes it on to the superordinate task.

If you define the parameter Object Variable, the system *creates a new object variable* with this name and the value of the script variable. An existing object variable of the same name will be overwritten and the script variable remains unchanged in this case.

 
Environment:
OS Version: N/A
Cause:
Cause type:
Defect
Root Cause: According to the documentation this is the correct behavior:

This script statement is similar to the script element :PSET. The difference is that the specified scripting variable must exist and that you can also use arrays.

and the sentence:

If you define the parameter Object Variable, the system creates a new object variable with this name and the value of the script variable.

is a bit misleading
Resolution:
Update to a fix version listed below or a newer version if available.

Fix Status: In Progress

Fix Version(s):
Automation Engine 12.2.0 - Planned release date: 2018-06-19
Automation Engine 12.1.1 - Available
Additional Information:
Workaround :
This causes the error:
:SET &P_LKZ# = 'hallo'
:PUBLISH &P_LKZ#, lkz#, 'WORKFLOW'
:PRINT 'lkz: &lkz#'

If this is changed as outlined below, it will work.
:SET &P_LKZ# = 'hallo'
:DEFINE &lkz#, unsigned
:PUBLISH &P_LKZ#, lkz#, 'WORKFLOW'
:PRINT 'lkz: &lkz#'