Liquid UI - Documentation - 23.12 set() using search option

23.12 set() using search option


Prerequisites

Purpose

You will learn how to use the set command with the search option to return a string immediately following the search term. To demonstrate this process, we are considering the Create Sales Order: Initial Screen as an example and guide you through the following steps:

  1. Navigate to Create Sales Order: Initial Screen and add a push button to execute the function and display the order number.
  2. Add a function to set the values in the required fields and display the order number.

User Interface

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

Customization

  1. Navigate to Create Sales Order: Initial screen and create a push button labeled Order number that executes a function (va01_test) and displays the order number.
     
    //Creates a push button that executes the function and displays the order number
    pushbutton([TOOLBAR] , "Order number" , "/nva01" ,{"process":va01_test});
    
     
     
  2. Add the va01_test function that sets the values into the required fields and displays the order number.
     
    //Function to display the order number
    function va01_test()
    { onscreen 'SAPMV45A.0101' // Assign OR value to Order Type field set("F[Order Type]" , "OR"); enter(); onscreen 'SAPMV45A.4001' // Assign 1460 value to Sold-to party field set("F[Sold-to party]" , "1460"); enter(); onscreen 'SAPMV45A.4001' println("----After entering sold-to party----"); enter("/11"); onscreen 'SAPMV45A.4001' if(_message)
    { // set command searches for Order string in the _message and assigns the string followed by the Order string to z_message variable set("V[z_message]","&V[_message]",{"search":"Order"}); println("After z_message>>>" +z_message); } enter("/nva01"); // Display the value in the z_message on the status bar message(z_message); }
     

SAP Process

  1. Refresh the SAP screen, enter OR in the Order Type input field, click the Order number push button, and then you will observe the Order number displayed at the bottom of the SAP screen, as shown in the image below.
     
     


Next Steps

Unpad Zeroes from String
Learn how to remove zeroes from a string entered on an SAP field.

10 min.

This article is part of the Invoking functions tutorial.


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