Liquid UI - Documentation - 8.09 switchto

8.09 switchto


Purpose

With switchto(), you can specify the file path to switch the execution control to the specified file. Usually, we include all the required Liquid UI configurations to work on the SAP in the configuration file (guixt.sjs). For instance, if you want to change the Liquid UI configurations based on the user log in, using the switchto command, you can switch to the new configuration file (guixt_ new.js), which is present either on your Local machine or Network share or an SAP Web Repository.

 

Syntax

You can use a single location or an array containing multiple locations in the switchto command syntax, as shown below:

DescriptionSyntax
Single location switchto = ["\\\\liquid-ui.com\\guixt\\guixt1.sjs"];
Multiple locations switchto = [ "\\\\liquid-ui.com\\LiquidUI\\guixt1.sjs", "\\\\ProgramFiles(X86)\\GUIXT\\guixt2.sjs","\\\\ProgramFiles(X86)\\LiquidUI\\guixt3.sjs", ];
Multiple locations with system names switchto = [ "\\\\SYNACTIVE\\sarvani\\scripts\\guixt1.sjs","\\\\SYNACTIVE\\sarvani\\scripts\\guixt2.sjs","\\\\SYNACTIVE\\GUIXT\\guixt3.sjs", ];


Options

The switchto command does not take any options.


Recursive Deployment

The switchto command supports Recursive Deployment, which means if there exists multiple guixt.sjs files and each one contains a switchto statement, then the configurations defined under the last valid guixt.sjs file is used.

For example, if the first guixt.sjs file resides on the local system and contains a switchto statement specifying two guixt files, then, the switchto command will parse the paths and proceed to the first valid file. Let’s consider that this file would be 'C:\\test\guixt\\guixt1.sjs’.

However, within this new guixt1.sjs file there is also a switchto command, listing three more directories. Here, the first one proves to be invalid - perhaps it is missing a script directory or maybe the RFC user information is incorrectly defined. In that case, the second guixt.sjs file path is selected, which is '\\\\netshare\\guixt\\guixt2.sjs'.

The guixt2.sjs file on net share contains a valid script directory, so at that point, the switchto command ceases looking for additional guixt.sjs files. , so at that point, the switchto command ceases to look for additional guixt.sjs files.This process is illustrated in the following diagram:

 

 
 

The storage location of the guixt.sjs file specified in the switchto command can be one of the following:

  • Local directory
  • Network share
  • SAP Web Repository


Local directory

You can use local variables and system variables in the switchto command, and switch to a config file residing on your local machine, as shown below::

  1. Open the configuration (guixt.sjs) file and enter the following:
     
    var z_filename = ["C:\\guixt\\file\\file_guixt.sjs"];"test_guixt.sjs ";
    switchto = [z_filename];

    The file path of the guixt.sjs file is assigned to a variable as its value. We can now use the variable in the switchto command instead of the file path.

    Note: For local variables, either the path or the file may be specified.

     
  2. If only the filename is specified and the user wishes to add it to an existing path in the switchto command, use the following code:
     
    var z_filename = "test_guixt.sjs";
    switchto = ["C:\\guixt\\" +z_filename];        
  3. To store an entire path in the variable:
     
    var z_filename = ["C:\\guixt\\test\\test_guixt.sjs"];
    switchto = [z_filename];    
    


Network share

To switch to a config file (guixt.sjs) that resides on a network share in the switchto command, you need to make sure that each element is separated by two backslashes - Webscript does not read it otherwise. The switchto command in the local guixt.sjs file is specified, as shown below:

switchto = ["\\server100\\LiquidUI\guixt.sjs"];


SAP Web Repository

Using switchto with SAPWR

To switch to a new config file (guixt.sjs) residing on an SAP Web Repository, you need to specify the rfcconnect connection details in the guixt.sjs file.

In local guixt.sjs file, directory1, and switchto command are specified as shown below:

directory1 = "C:\\LUI\\scripts"; 
switchto = ["SAPWR:Z.LUI.GUIXT.SJS"];

In the Web Repository, if the Z.LUI.GUIXT.SJS file specifies directory1 and directory0 parameters, as shown below:

directory0 = "C:\\LUI\\cache";
directory1 = "SAPWR:Z.LUI";

Then, the value of parameter directory1 will be updated to "SAPWR:Z.LUI" once Z.LUI.GUIXT.SJS is successfully read.


switchto using the system variables

Using the switchto command, you can access different configuration files containing different RFC usernames and passwords for the SAP systems. Generally, the switchto command is included in the main guixt.sjs file which is located in your SAP folder.

In this scenario, you will learn how to use _database system variable value in the switchto command to access different configuration files from the specified location.

  1.  Open the guixt.sjs file located in your SAPgui folder and enter the switchto command that switches to the file in the specified directory path.

     
    switchto = ["C:\\Program Files (x86)\\SAP\\FrontEnd\\SapGui\\guixt&V[_database].sjs"];
     

    Note: You need to place your new config file (guixtTRX.sjs) in the directory path mentioned in the switchto command to view the Liquid UI modifications.

     
  2. The '_database' system variable returns System ID of your SAP Server. For more information on system variables, please see the WS System Variables section.
     
  3. You can see in the Cornelius window how the switchto statement is used to switch between different config files based on the SAP server you have logged in. 
     
     

     


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