Liquid UI - Documentation - 10.01 Assign field values to variables and vice versa using set()

10.01 Assign field values to variables and vice versa using set()


Prerequisites


Purpose

Learn how to assign the value of an inputfield to the input field of another SAP screen using variables. We will walk you through the following steps.

  1. Add a pushbutton on an SAP screen
  2. Add a function to assign a value to an inputfield of another screen

//Create this file inside your script folder for customizing Change Sales Order screen SAPMV45A.E0101.sjs
//Now let's start adding the content to the above file

  1. Navigate through the Create Sales Order screen. Add a toolbar pushbutton as shown below:
     
    // Creates a pushbutton on toolbar that runs a z_process function 
    pushbutton([TOOLBAR],"Set",{"process":z_process});
    

     
  2. Add a function (z_process) to set Order Type value into a variable and then assign the variable value to the inputfield of another screen.
    // Add a function to assign values to an inputfield on the another screen
    function z_process() {
            set("V[z_order]", "&F[Order Type]");
            onscreen 'SAPMV45A.4001'
            inputfield([1,40], "Order", [1,56], {"size":10});
            set("F[Order]", "&V[z_order]");
    }
    

     
  3. Enter Order Type and click Set toolbar pushbutton on the screen.
     

     
  4. You will see the Order inputfield created in the Create Sales Order overview screen and the order type entered in the initial screen is assigned to the Order inputfield in the overview screen as shown below.
     


Next Steps

Assign values to multiple variables using z_
Learn how to load and clear values into the fields using variables

10 min.

This article is part of the Liquid UI Variables tutorial.


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