Liquid UI - Documentation - 10.02 Assign values to multiple variables using z_

10.02 Assign values to multiple variables using z_


Prerequisites


Purpose

Learn how to assign value into the inputfields and clear values of the inputfields. We will walk you through the following steps.

  1. Delete unnecessary elements.
  2. Add five inputfields on the SAP Easy Access screen
  3. Add two pushbuttons to load variables and clear variables
  4. Add a function to load values into the inputfields
  5. Add a function to clear all the values in the inputfields

//Create this file inside your script folder for customizing SAP Easy Access screen SAPLSMTR_NAVIGATION.E0100.sjs
//Now let's start adding the content to the above file

  1. Delete the image container on the SAP Easy Access screen.
    del("X[IMAGE_CONTAINER]");
    
     

     
  2. Add five inputfields on the screen sequentially as shown below:
     
    // Creates five inputfields with technical names as z_var1, z_var2, etc.
    inputfield([0,0],"Variable_1",[0,12],{"size":15,"name":"z_var1"});
    inputfield([1,0],"Variable_2",[1,12],{"size":15,"name":"z_var2"});
    inputfield([2,0],"Variable_3",[2,12],{"size":15,"name":"z_var3"});
    inputfield([3,0],"Variable_4",[3,12],{"size":15,"name":"z_var4"});
    inputfield([4,0],"Variable_5",[4,12],{"size":15,"name":"z_var5"});
    

     
  3. Add two pushbuttons Load Variables and Clear Variables on the screen as shown below:
     
    // Creates a pushbutton that runs a loadVar function to load variable values 
    pushbutton([0,35],"Load Variables",{"process":loadVar});
    // Creates a pushbutton that runs a clearVar function to load variable values pushbutton([1,35],"Clear Variables",{"process":clearVar});

     
  4. Add a function (loadVar) to set all the variable inputfields with GROUP-SET value.
    // Creates a function loadVar that sets variables to "GROUP-SET"
    function loadVar()
    {
    set("V[z_*","GROUP-SET");
    }

     
  5. Add a function clearVar to clear all the inputfields with null values.
     
    // Creates a function that assigns null values to all the variables with technical name starting with z_ 
    function clearVar()
    {
    set("V[z_*","");
    }

     
  6. Click the Load Variables pushbutton to load values into the inputfields.
     
  7. Click the Clear Variables pushbutton to load values into the inputfields.
     


Next Steps

Assign values into SAP table from Liquid UI table
Learn how to assign values into the SAP table using variables

10 min.

This article is part of the Liquid UI Variables tutorial.


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