The switchto command is used principally to map a user's individual guixt.sjs file to a main guixt.sjs file hosted on a server. This objective is useful for enabling users to see configuration changes without the necessity of making changes to a local profile. There are two possible syntaxes, depending if a single statement or an array containing multiple locations is to be used.
|Single Example||switchto = ["\\\\company.com\\guixt\\guixt1.sjs"];|
|Array example||switchto = [ "\\\\customer.com\\GUIXT\\guixt1.sjs", "\\\\customer.com\\GUIXT\\guixt2.sjs","\\\\customer.com\\GUIXT\\guixt3.sjs", ];|
|Array example with system names||switchto = [ "\\\\COMPUTER\\GUIXT\\guixt1.sjs","\\\\COMPUTER\\GUIXT\\guixt2.sjs","\\\\COMPUTER\\GUIXT\\guixt3.sjs", ];|
If no sjs file in the array is specified as being active WS will parse and select the first available location. If both a single statement and an array are contained within a given guixt.sjs file, the array will take precedence. The storage location can be one of the following:
- Local directory
- Network share
- SAP Web Repository
When specifying a network share, it is important to make sure that each element is separated by two backslashes - Webscript has problems reading it otherwise. For the SAP Web Repository, the file location syntax must be written as follows:
The switchto command does not take any options.
The switchto command enables recursive deployment. What this means is that if there are multiple guixt.sjs files and each one contains a switchto statement, the last valid file will be the one used.
For example, if the first guixt.sjs file resides on the local system and contains a switchto statement specifying two guixt files, the switchto command will parse the paths and proceed to the first valid file. In our example, this file would be 'C:\\text\guixt\\guixt1.sjs. However, within this new guixt.sjs file there is also a switchto command, listing three more directories. The first one proves to be invalid - perhaps it is missing a script directory or maybe the RFC user information is incorrectly defined. So the second guixt.sjs file is selected. In our example, this new guixt.sjs file is '\\\\netshare\\guixt\\guixt2.sjs'. The guixt.sjs file on netshare contains a valid script directory, so at that point, the switchto command ceases looking for additional guixt.sjs files. This process is illustrated in the following diagram:
Using switchto with SAPWR
Using switchto with local variables
- Open the guixt.sjs file and enter the following:
var z_filename = "test_guixt.sjs "; switchto = [z_filename];
We have now specified a variable and assigned it a file path as a 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.
- 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];
- To store an entire path in the variable:
var z_filename = ["C:\\guixt\\test\\test_guixt.sjs"]; switchto = [z_filename];
Using system variables
- Open the guixt.sjs file and enter the following code:
switchto = ["\\\\directory\\&V[_database].guixt.sjs"];
- The '_database' system variable returns the name of the file path of your system's guixt.sjs file. For more information on system variables, please see the WS System Variables section.
In local guixt.sjs file, directory1 and switchto parameters are specified as below.
directory1 = "C:\\LUI\\scripts";
switchto = ["SAPWR:Z.LUI.GUIXT.SJS"];
In Web Repository, the Z.LUI.GUIXT.SJS file also specifies directory1 and directory0 parameters.
directory0 = "C:\\LUI\\cache";
directory1 = "SAPWR:Z.LUI";
Hence, the value of parameter directory1 will be updated to "SAPWR:Z.LUI" once Z.LUI.GUIXT.SJS is successfully read.