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. We will walk you through the following steps.

  1. Add a pushbutton
  2. Add a function to retrieve the required value from the required transaction

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

  1. Navigate to Create Sales Order screen to search for the required order number.
     

     
  2. Add a toolbar pushbutton to execute a function (va01_test) on click.
     
    //Creates a pushbutton with a label as test and executes the va01_test function on click
    pushbutton([TOOLBAR] , "test" , "/nva01" ,{"process":va01_test});
    

     
  3. Add a function va01_test to set values into the required fields and perform required actions on the screen to obtain the sales order number.
     
    //Creates a function to display the sales order number from the SAP message
    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); }

     
  4. Click the toolbar pushbutton on the Create Sales Order screen. You will see the order number on the status bar retrieved from the SAP message displayed on the Create Sales Order Overview screen after saving the assigned details.

     


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?