Liquid UI - Documentation - 19.16 Pass values to function

19.16 Pass values to function


Prerequisites

Purpose

The "Using" option enables you to pass variables to functions when initiating processes. By utilizing the "Using" option, you can easily display messages on the SAP screen based on the input values provided by the user. In this example, we will demonstrate the application of the Using option on the SAP Easy Access screen and will guide you through the following steps.

  1. Delete the image container on the SAP Easy Access Screen
  2. Add an input field to enter the name
  3. Add a push button to display a welcome message with a name.
  4. Add a function to display a welcome message.

User Interface

//Create this file inside your script folder for customizing the SAP Easy Access screen, SAPLSMTR_NAVIGATION.E0100.sjs

//Now, let's add the Liquid UI script to the above file and save it.


Customization

  1. Delete the image container on the SAP Easy Access screen using del().
     
    // Deletes the image container
    del("X[IMAGE_CONTAINER]");
    
     
     
  2. Add an input field labeled Your Name to enter the user name.
     
    // Creates an input field to enter the name of the User
    inputfield([0,0],"Your Name:",[0,12],{"size":20,"name":"z_name"});
    
     
     
  3. Add a push button labeled Enter to display the welcome message with the name entered.
     
    // Creates a push button labeled Enter
    // use "using" to pass the variable for the name
    pushbutton([0,35],"Enter",{"process":displayMessage,"using":{"name":"&V[z_name]"}});
     
     
  4. Add a function to display a welcome message.
     
    // Function to display the welcome message
    function displayMessage(param)
    {
        message("S:Welcome to the Easy Access Screen, "+param.name+"!") }
     

SAP Process

  1. Refresh the SAP Easy Access screen. Enter the name in the input field and click the Enter push button to display a welcome message with the specified name at the bottom of the screen, as shown below.
     
     

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