Liquid UI - Documentation - 19.11 Execute functions dynamically

19.11 Execute functions dynamically


Prerequisites

Purpose

To explain the dynamic navigation of transactions within SAP through functions. The following scenarios illustrate this process:

  1. Navigate to the required transaction by inputting the SAP module into the input field.
  2. Navigate to a specific transaction using push buttons.
     

Scenario 1:

To demonstrate navigation to the required transaction based on the SAP module entered in the input field, we’ll use the SAP Easy Access screen and will walk you through the following steps.

  1. Delete an image container on the SAP Easy Access screen
  2. Add an input field to enter the module
  3. Add a push button to navigate to a specified module
  4. Add a function to navigate to the Sales Order screen
  5. Add a function to navigate to the Create Material screen
  6. Display navigation through transactions based on the module chosen
     

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 Module to enter the module value.
     
    // Creates an input field to enter the Module value
    inputfield([1,1],"Module:",[1,10],{"size":2,"name":"z_name"});
    
     
  3. Add a push button labeled RFC test to navigate to the module screen based on the value entered in the input field.
     
    // Creates a push button to run the required function based on the value entered in the input field
    pushbutton([1,20],"RFC Test",{"process":['RFCTestFunc&V[z_name]']}});
    
     
     
  4. Add a function to navigate to the Create Sales Order: Initial Screen.
     
    // function navigates to VA01 screen 
    function RFCTestFuncSD()
    {
    enter('/nva01');	
    }
    
     
  5. Add a function to navigate to the Create Material (Initial Screen).
     
    // function navigates to MM01 screen
    function RFCTestFuncMM() { enter('/nmm01'); }
     

SAP Process

  1. Refresh the SAP Easy Access screen. Enter SD in the Module input field and click the RFC test push button. You will be navigated to the Create Sales Order: Initial Screen, as shown below.
     
     
  2. Similarly, enter PM and click the RFC test push button. You will be navigated to the Create Material (Initial Screen), as shown below.
     
     

Scenario 2:

In this use case, we will illustrate the process of invoking a function with varying parameter values based on the selection of a push button on the SAP Easy Access screen. The steps involved in this process are as follows:

  1. Delete the image container on the SAP Easy Access screen
  2. Add three push buttons for navigation
  3. Add a function to navigate to specific transactions
  4. Display navigation to specific transactions
     

User Interface

  1. Delete the image container on the SAP Easy Access screen using del().
     
    // Deletes the image container
    del("X[IMAGE_CONTAINER]");
    
     
     
  2. Add three push buttons labeled VA01, MM01, and CS01 to navigate through transactions by passing parameter values to the specific function.
     
    // Create pushbuttons with title, executes function on click where the eval function gets the myfunction variable value
    pushbutton([1,4], "VA01", "?", {"size":[2,20], "process":eval(myfunction), "using":{"l_screen":"VA01"}});
    pushbutton([4,4], "MM01", "?", {"size":[2,20], "process":eval(myfunction), "using":{"l_screen":"MM01"}});
    pushbutton([7,4], "CS01", "?", {"size":[2,20], "process":eval(myfunction), "using":{"l_screen":"CS01"}});
    
     
     
  3. Assign string value to a variable.
     
    // Declare a variable
    var myfunction = "variableFunction";
    
     
  4. Add a function to navigate to the transaction based on the pushbutton clicked.
     
    //Function to navigate to the required transaction based on the parameter value of the pushbutton clicked
    function variableFunction(param){
       onscreen 'SAPLSMTR_NAVIGATION.0100'
          enter("/n"+param.l_screen);
    }
    
     

SAP Process

  1. Refresh the SAP Easy Access screen and click the VA01 push button to navigate through the Create Sales Order: Initial Screen.
     
     
  2. Similarly, clicking MM01 or CS01 will take you to the desired screens.
     


Next Steps

Increment counter using appendfile()
Learn how to add content in a file through the SAP GUI.

10 min.

This article is part of the Invoking functions tutorial.


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