Purpose
With set(), you can assign a value to a variable or to a field value in a SAP screen.
The fields can either be generated from GuiXT or native SAP fields, although the usage of the set command is different when a SAP element is involved as opposed to when a GuiXT element is used. There are several different possible syntaxes for set, which are shown in the table below:
Note: Beginning version 1.2.290, avoid space in cell parameter. For instance, cell[table, column, row] has changed to cell[table,column,row].
Element |
Syntax |
Description |
---|---|---|
Table-value | set("cell[table,column,row]","abc"); | Sets a value into a specified cell in a table. |
Table-variable value | set("cell[table,column,row]","&V[z_var]"); | Sets a value from a variable into a specified cell in a table. |
Checkbox-checked | set("C[checkbox]","X"); | Marks the specified checkbox as being checked. |
Checkbox- unchecked | set("C[checkbox]",""); | Marks the specified checkbox as being unchecked. |
Field-value | set("F[name]","abc"); | Sets a specified value into a SAP inputfield. |
Field-variable value | set("F[name]","&V[z_var]"); | Sets the value of a variable into the specified field. |
Radiobutton-checked | set("R[radiobutton]","X"); | Selects the radiobutton. |
Variable-value | set("V[z_var]","abc"); | Sets the specified value into a variable. |
Varible-cellvalue of a table | set("V[z_var]","&cell[table,col,row]"); | Sets a variable with the value contained in the specified table cell. |
Varible-checkboxvalue | set("V[z_var]","&C[checkbox]"); | Reads the checkbox selection and sets the variable with the checkbox value. If the checkbox is selected, the value will be "X" otherwise the value will be blank. |
Varible-fieldvalue | set("V[z_var]","&F[inputfield]"); | Sets a variable with the value contained in the specified inputfield. |
Varible-radiobuttonvalue | set("V[z_var]","&R[radiobutton]"); | Reads the radiobutton selection and sets the variable with the radiobutton value. If the radiobutton is selected, the value will be "X" otherwise the value will be blank. |
Varible-another variablevalue | set("V[z_var]","&V[param]"); | Sets a value of one variable into a different variable. |
Varible-systemvariablevalue | set("V[z_var]","&V[_systemVariable]"); | Sets the value of a system variable into a variable. |
Available Options
You can use the following options with the set:
"search":"string" - searches the string in the specified text and returns the next immediate string in the text to the field. |
|
"uppercase":"true" - Converts the value of the field to uppercase. |
Options Detail
search |
|
uppercase |
|
Example
The fields can either be generated from Liquid UI or native SAP fields, although the usage of the set command is different when a SAP element is involved as opposed to when a Liquid UI element is used. The search option specifies that a given string will be searched in the relevant text.
The following scenario demonstrates the usage of set commands in selecting the radiobutton.
Script
set("R[Collective Slip]","X");
Usage Details
-
Liquid UI: Set a Group of Variables
The set command can be used to set more than one variable.
set("V[z_*","GROUP-SET");
Learn more about how to set group of values to inputfields.
-
Passing values to a web server using _connectiondata and set()
-
Assign values into SAP table from Liquid UI table using set()
-
Get data from SAP table using table scrolling logic and set()
-
Convert time from milliseconds to days/hours/minutes/seconds with set().
-
Get first visible row and last visible row values from a listscreen using set()