Liquid UI - Documentation - 6.22 set()

6.22 set()


Purpose

The set() command facilitates the assignment of values to various screen elements and variables. This includes input fields, checkboxes, radio buttons, tables, and other variables. The specific syntax and usage of set() will differ based on the type of target element.

 

Note: From version 1.2.290, avoid using spaces in cell[]. Use cell[table, column, row] instead of cell[table, column, row].

 

Element

Syntax

Description

Table-value set("cell[table,column,row]","abc"); Assigns a value to a table cell.
Table-variable value set("cell[table,column,row]","&V[z_var]"); Assigns a variable’s value to a specific table cell.
Checkbox-checked set("C[checkbox]","X"); Checks the specified checkbox.
Checkbox- unchecked set("C[checkbox]",""); Unchecks the specified checkbox.
Field-value set("F[name]","abc"); Sets a specified value in an input field.
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]"); Stores the value from a table cell into a variable.
Varible-checkboxvalue set("V[z_var]","&C[checkbox]"); Stores the checkbox value into a variable ("X" if checked, blank if not).
Varible-fieldvalue set("V[z_var]","&F[inputfield]"); Reads an input field value into a variable.
Varible-radiobuttonvalue set("V[z_var]","&R[radiobutton]"); Stores radio button value into a variable. ("X" if selected, blank if not).
Varible-another variablevalue set("V[z_var]","&V[param]"); Sets the value of one variable into another.
Varible-systemvariablevalue set("V[z_var]","&V[_systemVariable]"); Assigns a system variable's value to a custom variable.
 

Available Options

You can use the following options with the set():

"search":".."

"search":"string" - Searches for the specified string in the text and returns the next immediate string.

"uppercase":".."

"uppercase":"true" - Converts the value to uppercase

Options Detail

  1. The search option allows you to locate a specific keyword within a given text and retrieve the word that immediately follows it. This is particularly useful for extracting dynamic values from system messages or other text variables.
     
    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"}); 
     
  2. This option searches for the word order within V[temp], and assigns the next word OR to V[temp1].
     
    // Assigns value to a variable
    temp = "standard order OR xyz";
    set("V[temp1]","&V[temp]",{"search":"order"});
     
    Finds the Order which is then to assigned to other variable
     
  3. As per the code, the word following the search string order is OR, which is then assigned to the variable temp1.
     

    Click here for details about the set() using the search option.

uppercase

  1. The uppercase option automatically converts the assigned value to uppercase before setting it to the target field or variable. The syntax is as follows:
     
     set("V[z_var]",value,{"uppercase":true});
     
  2. This option converts the value or to OR before being set in the Order Type input field.
     
    // Converts the value into uppercase
    set("F[Order Type]","or",{"uppercase":true});
     
    Converts the value into uppercase
     

Example

The following example demonstrates how to use the set() to pass selected radio button values from one screen to another.

//Create the file SAPMV45A.E0101.sjs inside your scripts folder for customizing the Create Sales Order: Initial Screen
//Now, add the Liquid UI script to the above file, and save it.

  1. Select the Collective Slip radio button using set().
     
    // Selects the radio button
    set("R[Collective Slip]","X");
    
     
  2. From the Create Sales Order: Initial screen, select Collective Slip and click the push button. This will navigate you to the MB1C transaction. Here, the Collective Slip radio button will be pre-selected, demonstrating how radio button values are passed between screens using set().
     
    Clicking Collective Slip navigates to MB1C with the option pre-selected using set command
     

    Click here for details about how to assign values to screen elements.

Example 2: Set a Group of Variables

This example demonstrates how to set a group of variables and pass values to the input fields using set().

  1. Set a value to the variables using set().
     
    // Sets value to the variables
    set("V[z_*]","GROUP-SET");
    
     
  2. After refreshing SAP Easy Access, click Load Variables push button to populate input fields automatically with assigned values.
     
    Click Load Variables to auto-fill input fields with assigned values
     

    Click here to learn how to set a group of values to input fields.

Usage Details


Can't find the answers you're looking for?