When defining process instructions, you can use simple or global variables that you have defined in another process instruction:
You can use simple variables in browser-based PI sheets and manufacturing cockpits . However, they are only valid for the same control recipe or cockpit.
Global variables can be exchanged as follows:
Using the declaration between different PI sheets of the same process order
As data points using the internal interface Manufacturing Data Access:
Between PI sheets of different process orders
Between PI sheets and cockpits
Between different cockpits
You can use variables in the following functions, for example:
To transfer a characteristic value as the default value in entriesSee also: Type 0: Definition of Default Values
To transfer a character value that is only available in the PI sheet or cockpit as a parameter value in input validationsSee also: Type 0: Definition of Input Validations
To display values in the PI sheet or cockpit that are usually processed in the background (for example, in calculations)See also: Type 0: Definition of Output Fields for Variable Values
To transfer a characteristic value from one process instruction to anotherSee also: Type 0: Definition of Value Assignment Using Variables
To transfer the value of an export, table, or changing parameter that is not yet available in the PI sheet or cockpit to the function moduleSee also: Type 0: Definition of Export Parameters , Type 0: Definition of Table Parameters and Type 0: Definition of Changing Parameters
If you want to transfer the value of a variable to the current process instruction, the following requirements must be met:
The simple variable must be defined in the same PI sheet or cockpit
The global variable must be defined for the entire process order
Exception: The following system variables that are defined by SAP and start with SY_ need not be defined in the process instruction:
System Variable |
Meaning |
SY_MODE |
Current mode of the PI sheet |
SY_TEST |
Status of the PI sheet (test or active) |
SY_ROW |
Current table line |
SY_VALUE and X |
Refers to the immediately preceding input value |
See also: Using System Variables
The variable’s data type is suitable for the purpose for which you want to use the variable. You need:
Data type NUM for check formulas of input validations and for calculation formulas
The data type of the corresponding parameter for check functions of input validations and for dynamic function calls
The data type of the relevant input value for default values
Any data type for output values
The data type of the message characteristic to be assigned a value for hidden data requests
The data type of a variable is identical to that of the characteristic or parameter to which it refers.
See also: Definition of Variables
Using Simple Variables
In simple data requests
Simple variables defined in a simple data request or function call refer to exactly one value. In this case, you must only enter the variable name to transfer the value into another process instruction.
Example
The simple variable VAR is defined for the input value "Material quantity". The value of variable VAR is to be displayed in process instruction 0020 of the same PI sheet.
Process instruction 0010:
PPPI_INPUT_REQUEST |
Material quantity |
|
PPPI_VARIABLE |
VAR |
|
PPPI_REQUESTED_VALUE |
PPPI_MATERIAL_QUANTITY |
Process instruction 0020:
PPPI_OUTPUT_TEXT |
Material quantity |
|
PPPI_OUTPUT_VARIABLE |
VAR |
In repeated data requests
Simple variables defined in a repeated data request , however, represent an entire table column. To refer to a specific table entry, you must extend the variable name. The following rules apply:
<Variable name>_1 |
-> |
Value in first line of table |
<Variable name>_2 |
-> |
Value in second line of table |
And so on |
And so on |
|
<Variable name>_SUM |
-> |
Sum of the values in the table column |
<Variable name>_COUNT |
-> |
Number of values in the table column |
Note
Variables referring to tables are transferred line by line. If you want to display a variable as the default value (PPPI_DEFAULT_VARIABLE), for example, the system displays the relevant default value when a new line is added. If no value has been assigned to a variable, the new line in the output table remains empty.
Using Global Variables
When using global variables, you can choose from the following options:
As a data point If you want to exchange variables between PI sheets and cockpits, you must use the internal interface Manufacturing Data Access . The variable values are transferred once they are changed.
For more information on Manufacturing Data Access , see:
You use the following characteristics in the sequence specified:
Read Data
Characteristic |
Meaning |
|
PPPI_DATA_ACCESS |
Manufacturing Data Access |
|
PPPI_BUTTON_TEXT |
Text for pushbutton |
|
PPPI_FUNCTION_DURING_DISPLAY |
Setting to specify whether the function is permitted in display mode |
|
PPPI_IMPORT_DATA |
Global variable of the application from which the value is to be transferred to the subsequent variable |
|
Parameter characteristic |
Variable names with the corresponding data type |
Example
Global variable VARGL is defined for the input value "Material quantity" in cockpit PMC1.The value of the global variable VARGL is to be read as a data point in cockpit PMC2 using Manufacturing Data Access . The value of variable VARGL is to be transferred to the local variable VARLC and displayed in the cockpit.
Cockpit PMC1:
PPPI_INPUT_REQUEST |
Material quantity |
|
PPPI_GLOBAL_VARIABLE |
VARGL |
|
PPPI_REQUESTED_VALUE |
PPPI_MATERIAL_QUANTITY |
Cockpit PMC2:
PPPI_DATA_ACCESS |
Manufacturing Data Access |
|
PPPI_BUTTON_TEXT |
Read material quantity from PCM1 |
|
PPPI_FUNCTION_DURING_DISPLAY |
Permitted |
|
PPPI_IMPORT_DATA |
PMC:1100.PMC1. VARGL |
|
PPPI_STRING_VARIABLE |
VARLC |
|
PPPI_OUTPUT_TEXT |
Material quantity from PMC1 |
|
PPPI_OUTPUT_VARIABLE |
VARLC |
Write Data
Characteristic |
Meaning |
|
PPPI_DATA_ACCESS |
Manufacturing Data Access |
|
PPPI_BUTTON_TEXT |
Text for pushbutton |
|
PPPI_FUNCTION_DURING_DISPLAY |
Setting to specify whether the function is permitted in display mode |
|
PPPI_EXPORT_DATA |
Data point or global variable of the application into which the value of the subsequent variable is to be transferred |
|
Parameter characteristic |
Variable names with the corresponding data type |
Using a declaration If you want to exchange variables between PI sheets of the same process order, you can use the declaration method. Here, you must first declare the global variable in the control recipe in which you want to use it. When you use variables in this way, the variable values are not transferred until the PI sheet is completed. You can declare global variables in PI sheets only. To do so, you define the following information in the process instruction:
The variable name you want to declare
The characteristic that specifies the type of variable used
To enter this information, you assign the following characteristics to the process instruction in the sequence specified below:
Characteristic |
Meaning |
Allowed Values |
PPPI_DECLARE_VARIABLE |
Declaration of global variable |
Existing variable name |
PPPI_VARIABLE_TYPE |
Type of variable |
Characteristic used to define the global variable |
Example
PI sheet 0001:
PPPI_INPUT_REQUEST |
Material quantity |
|
PPPI_GLOBAL_VARIABLE |
VARGL |
|
PPPI_REQUESTED_VALUE |
PPPI_MATERIAL_QUANTITY |
PI sheet 0002:
PPPI_DECLARE_VARIABLE |
VARGL |
|
PPPI_VARIABLE_TYPE |
PPPI_MATERIAL_QUANTITY |
|
PPPI_OUTPUT_TEXT |
Material quantity from |
|
PPPI_OUTPUT_VARIABLE |
VARGL |
Note the following with repeated data requests:
You can use global variables, to transfer entire tables (repeated data request) to another control recipe, for example to a function module.
At present, it is, however, not possible to display the entire table in the PI sheet. However, you can refer to individual values in a table. To do so, you must define a variable with an extension for the relevant table line for each table value. To do so, you add the suffix _1, _2, _3 and so on to the variable name for every table line.
Example:
WERT _1 -> Value in the first table line WERT _2 -> Value in the second table line And so on
To be able to use the variables in a control recipe, you must first declare each variable name (along with the above suffix) in the recipe in which you want to use the variable.