Liquid UI - WS Reference Library

set()


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, there shouldn't be any 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":".."

"search":"string" - searches the string in the specified text and returns the next immediate string in the text to the field.

"uppercase":".."

"uppercase":"true" - Converts the value of the field to uppercase.


Options Detail

search

  1. The search option specifies that a given string will be searched in the relevant text. The 'z_var' variable refers to the text that will be searched, which in this case is drawn from the _message system variable. The text case will be ignored. There are multiple syntaxes possible and these are as follows:

  2. set("V[z_var]",value,{"search":"string"});
    set("V[z_var]","",{"search":"string"});
    set("F[Field]","&V[z_var]",{"search":"string"});
    set("V[z_var]","&F[Field]",{"search":"string"}); 
  3. This option searches the string in the specified text and returns the next immediate string after the search string to the field. The search option currently works as following:

    temp = "standard order OR xyz";
    set("V[temp1]","&V[temp]",{"search":"order"});
  4. As per the code, the string next to the search string "order" is OR and it is set to the temp1 variable.

uppercase

  1. The uppercase option will set the value to uppercase. The syntax is as follows:

  2.  set("V[z_var]",value,{"uppercase":true});
  3. The uppercase option is implemented sebsequently from the 1.2.141.0 WS release.
  4. set("F[Order Type]","or",{"uppercase":true});
  5. As per the code, the "or" value is converted into uppercase and then set into Order Type field.


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");

Script Details


Tips and Tricks

  • 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.