Prerequisites
- Products: Liquid UI WS, Liquid UI Server or Local DLL, Client Software
- Commands: set(), onscreen(), enter(), _ashost
Purpose
You will learn how to use the system variable in retrieving the acutal server name of the SAP sever. This variable is very useful when you are working on multiple SAP ERP systems. We will walk you through the following steps.
- Delete unnecessary screen elements
- Add a condition to check the server name
- Add a function to dynamically navigate through the other transaction
//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
- Delete redundant/unneeded screen elements on the SAP Easy Access screen.
del("X[IMAGE_CONTAINER]");
- Add a condition to check the server name and based on the server retrieved, you will be navigated to the assigned transaction.
if(_ashost == "juneau"){ set("V[z_tran]","/nVA01"); } else if(_ashost == "ZEUS"){ set("V[z_tran]","/nMM01"); }
- Add a function to navigate to the transaction dynamically.
//on enter navigates to “VA01” if server is Juneau and to “MM01” if server is zues function z_navigate(){ // SAP Easy Access onscreen 'SAPLSMTR_NAVIGATION.0100' enter("&V[z_tran]"); }
- On performing enter operation, the z_navigate process should be called.
//Executes z_navigate on performing enter
onUIEvents['enter']=z_navigate;
- You will see the SAP server name in the console window.
//Displays server name on the console window
println("Name of the server in use is "+_ashost);
- Open SAP Easy Access screen in Juneau(SAP server name) SAP server and click continue to navigate through the Create Sales Order screen.
- Open SAP Easy Access screen in Zeus(SAP server name) SAP server and click continue to navigate through the Create Material screen
Next Steps
Change your SAP GUI layout based on the client device
Learn how to change the layout of your SAP GUI based on the device used.
Learn how to change the layout of your SAP GUI based on the device used.
5 min
This article is part of the Conditional scripts tutorial.