Liquid UI - Documentation - 23.06 Automatic display of values in the fields

23.06 Automatic display of values in the fields


Prerequisites


Purpose

Learn how to display values into the inputfields automatically from a message. We will walk you through the following steps.

  1. Delete an image container
  2. Add two inputfields
  3. Add a pushbutton
  4. Add functionality to retrieve values from a message

//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 an image container on the SAP Easy Access screen.
    // Delete an Activex Controller on the screen
    del('X[IMAGE_CONTAINER]');    
    
     
  2. Add two noneditable input fields Order Number and Deliv. Number.
    //Creates two inputfields Order Number and Deliv. Number and are non editable
    inputfield([1,1],"Order Number", [1,15], {"name":"z_num0", "size":"15", "readonly":true});
    inputfield([2,1],"Deliv. Number", [2,15], {"name":"z_num1", "size":"15", "readonly":true});
    
     
     
  3. Add a pushbutton on the toolbar which on click executes a testFunction process.
    //Creates a toolbar pushbutton to execute a process on click
    pushbutton([TOOLBAR],'Execute','?',{'process':testFunction});    // Function Call
    
     
     
  4. Click Execute toolbar pushbutton that executes a function associated with it to retrieve required values from a message and assigns them to the input field.
    // Extract values from an message and display them in the inputfield
    function testFunction(){    
        myarr = [];
        mymsg = 'The order 123021213 is saved and 542321 updated';    // Sample message
        var res = mymsg.match(/[-+]?[0-9]*\.?[0-9]+/g);
        myarr = res.toString().split(',');    // Store the numbers in an array
        
        for(var idx=0;idx<myarr.length;idx++){
            set('V[z_num&V[idx]]',myarr[idx]);
        }    
    }
    
     
     


Next Steps

Translate text to another language
Learn how to translate the text entered in the inputfield using wscurl.

10 min.

This article is part of the Take a deep dive into the input field and pushbutton tutorial.


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