Liquid UI - Documentation - 8.12 WS System Variables

8.12 WS System Variables


 Purpose

Within the WS platform, we have various system variables which indicate the state of the system at any given time. These variables are filled at the run-time. Using these system variable values, you can perform an action on a variety of system-related tasks.

You can view a complete list of system variables supported by WS along with a detailed explanation of each system variable in terms of access and the usage of those values.


List of WS System Variables


_ashost

The _ashost variable specifies the actual server name of the SAP server and is particularly useful when users are connecting to multiple SAP ERP systems. Operations can be performed based on a particular system name. In the following example we will print out the server:

println("Host>>" +_ashost);


_blackbox

The _blackbox is a system variable used to specify the exception that occurred during an RFC call. Here is the example to print out the exception that occurred during execution:

println("Exception occurred >>" +_blackbox);


_builddate

The _builddate variable specifies the release date of the latest version of SAP server. Operations can be performed based on a particular system name. This is particularly useful when users are connecting to multiple SAP ERP systems. In the following example we will print out the server:

println("build date" +_builddate);


_client

The _client variable can be used to find data of a user in the system. The following line of code will explain how to find the current user, and then display the result on the console window.

println("Current user>>" + _client);


_clientedition

The _clientedition variable is used to gather information about the client platform in order to create a single customized script for different platforms. In other words, the script can dynamically relocate a button based on the dimensions of the client platform. The syntax is shown below:

if("_clientedition == undefined){
    image([0,1],"sapgui.jpg",{"nostretch":true,"plain":true}); 

For example, based on portrait or horizontal position on the iPad. The variable is formatted in a four-digit number, followed by two integers as in the following example:

XGFS 4 7

This example would be interpreted as shown in the following example.

  • X = client license
  • G = Liquid UI (iOS)
  • F = iPhone
  • S = iOS emulator
  • 4 = 400 pixels (screen width)
  • 7 = 700 pixels (screen height)

These parameters are further explained as follows:

License Type

The first letter in the _clientedition variable indicates the license type. The available options are as follows:

  • X = Standard license
  • E = Enterprise license
  • T = Trial license
Platform Type

The second letter denotes the platform - iOS or Windows Mobile. The available options are as follows:

  • A = Liquid UI for Android
  • G = Liquid UI for iOS
Hardware Type

If the second letter is 'G', the third letter specifies the actual iOS hardware. The available options are:

  • F = Android Phone / iPhone
  • P = Android Tablet / iPad
  • O = iPod
  • M = iPad Mini

If the second letter is 'M', then the third letter specifies the Windows Mobile hardware. The available options are:

  • 4 = CE 4.0
  • 5 = CE 5.0
Device Type

The fourth digit specifies whether the software is running on an emulator or on a physical device. The available options are shown below:

  • S = Emulator
  • If the device is not an emulator, there will be no fourth digit
Screen X-Parameter

The X-parameter for the screen in pixels is placed three spaces after the last digit in the variable. It specifies the screen width in hundreds of pixels. So, a screen width of 300 would be designated as '3'.

Screen Y-Parameter

The Y-parameter for the screen in pixels is placed in three spaces after the last digit in the variable. It specifies the screen height in hundreds of pixels. So, a screen height of 1400 would be designated as '14'.

_clipboard

The '_clipboard' system variable is used to hold the data copied to/from the clipboard. Data copied can be in either string, multi-line text, or array format. This is particularly useful when passing details or content from one screen to another in SAP. The syntax is as follows.

println("Clipboard content is >>" +_clipboard);


_connectiondata

This feature can be used only with the GuiXT Web Server.

The '_connectiondata' system variable is used to enable scripts to access URL queries and pass them as parameters to the Web Server. This is particularly useful when passing a username and password to the Web browser. The syntax is as follows.

var obj = eval("(function(){return" + _connectiondata + ";})()");

The '_connectiondata' feature works by setting an object (var obj in our example), which has various properties. These properties correspond to the various parameters in a URL and are used to pass those parameter values to Web URLs. Some of the most commonly used properties are as follows.

 

Note: Please note that the following is not a full list of all the available parameters. You can set any parameters in a URL and pass them to a Web Server via scripting

_connectiondata properties

obj.user

This corresponds to the username in a Web URL, such as in the following example, where the value of 'obj.user' would be 'sample user'.

http://localhost:80/guixt4web/logon.gsp?user=sampleuser&pass=samplepass
obj.password

This corresponds to a password in a Web URL, such as in the following example, where the value of 'obj.password' would be 'sample pass'.

http://localhost:80/guixt4web/logon.gsp?user=sampleuser&pass=samplepass
obj.order

This specifies a particular order type for the Sales Order transactions. In our example, we are using the order type 'OR', for a Standard Order, as shown in the example URL below.

http://localhost/guixt4web/logon.gsp?user=dummy&pass=123&task=T1&tcode=va01
&ordType=OR&soldto=1460
obj.sample

This is a value that will be input into the QPR2 transaction in SAP. In our example, the value is '100000205' as shown in the example URL below.

http://localhost/guixt4web/logon.gsp?user=dummy&pass=123&task=T2&tcode=qpr2
&sample=100000205
obj.soldto

This is the customer code that will be input into the Sales Order transactions. In our example, the value is '1460' as shown in the example URL below.

http://localhost/guixt4web/logon.gsp?user=dummy&pass=123&task=T1&tcode=va01
&ordType=OR&soldto=1460
obj.task

This specifies an action that can be executed by the script. in the following example, the action will perform a switch, where depending on the parameters passed, we can perform multiple actions.

switch(obj.task){
case 'T1':
	if(obj.user && obj.pass){
		set("F[User]",obj.user);
		set("F[Password]",obj.pass);
	}
	enter({'process':goto_va01,"using":{"tcode":obj.tcode,
	"ordType":obj.ordType,
	"soldto":obj.soldto}});
	break;

case 'T2':
	if(obj.user && obj.pass){
		set("F[User]",obj.user);
		set("F[Password]",obj.pass);
	}
	enter({'process':goto_qpr2,"using":{"tcode":obj.tcode,
	"sample":obj.sample}});
	break;

The URLs for Case T1 and T2 from the above script would be as follows. The values for the Order Type and soldTo are provided by the URL and are passed to the SAP transaction by the processes.

http://localhost/guixt4web/logon.gsp?user=dummy&pass=123&task=T1&tcode=va01
&ordType=OR&soldto=1460
http://localhost/guixt4web/logon.gsp?user=dummy&pass=123&task=T2&tcode=qpr2
&sample=100000205
obj.tcode

This specifies a transaction code and is one of the parameters that can be included in a URL. You can also specify the tcode manually in the process. An example URL with a tcode is shown below.

http://localhost/guixt4web/logon.gsp?task=T5&tcode=qpr2&sample=100000205

Click here to view the example of _connectiondata.


_cursorcolname

The _cursorcolname system variable is used to retrieve the column name on which the cursor is placed. Column title appears on the screen while technical name can be used in the Liquid UI scripts. In the following example, we will print out the column name:

println("Column name is:" +_cursorcolname);


_cursorcoltechname

The _cursorcoltechname system variable is used to retrieve the technical name of the column on which the cursor is placed. Column technical name can be used in the Liquid UI scripts. In the following example, we will print out the column technical name:

println("Column technical name is:" +_cursorcoltechname);


_cursorfieldname

The _cursorfieldname system variable is used to retrieve the field name on which the cursor is placed. In the following example, we will print out the field name:

println("Field name is:" +_cursorfieldname);


_cursorfieldtechname

The _cursorfieldtechname system variable is used to retrieve the technical name of the field on which the cursor is placed. In the following example, we will print out the field technical name:

println("Table name is:" +_cursorfieldtechname);


_cursorrow

The _cursorrow system variable is used to retrieve the row number where the cursor is placed on the screen. In the following example, we will print out the row number of the cursor positioned:

println("Row where the cursor is placed: " +_cursorrow);


_cursorcol

The _cursorcol system variable is used to retrieve the column number where the cursor is placed on the screen. In the following example, we will print out the column number of the cursor positioned::

println("Column where the cursor is placed:" +_cursorcol);


_cursortabname

The _cursortabname system variable is used to retrieve the table title on which the cursor is placed. Table title appears on the screen while technical name can be used in the Liquid UI scripts. In the following example, we will print out the table name:

println("Table title is: " + _cursortabname);


_cursortabtechname

The _cursortabtechname system variable is used to retrieve the technical name of the table on which the cursor is placed. Table technical name can be used in the Liquid UI scripts. In the following example, we will print out the table technical name:

println("Table technical name is:" +_cursortabtechname);


_database

The _database variable can be used to perform operations based on the database or to simply find which database is being used. To find the database and to output that information to the console, we would write the following:

println("Database>>" +_database);


_directoryN

The _directoryN variable specifies the location of the scripts in the specified directory. N indicates the directory number, where its value varies between 0 to 4. This variable helps you to find out the location of the scripts easily without navigating to the guixt.sjs file in SAPgui folder.

println(" Scripts location" +_directory1);
 

Note: To return the script directory path on the status bar, you can enter below command in the SAP GUI command field(tcode field) /wsmessage(_directory1).


_dynpro

A DynPro is the actual SAP program name. Each SAP program is identified by a dynpro number. Examples of dynpro numbers are the following:

  • 0101
  • 0100

The dynpro is used with the language code and the program name to identify a given SAP screen. The _dynpro variable is used to find which dynpro is currently being accessed or to perform operations based on a particular dynpro number. In our example, we will simply find out which dynpro we are accessing and output that information to the console:

println("DynPro>>" +_dynpro);


_eventid

The _eventid variable is used to return the event option value of a pushbutton for a given implementation. If users are running different processes, this variable is useful for specifying the action performed by the pushbutton. To find the event performed using the pushbutton in console, we would write the following:

println("You have clicked >>" +_eventid);


_guixtsjs

The _guixtsjs variable is helpful in finding the location of the configuration file (guixt.sjs) in your system. You can set various parameters to configure your WS in this guixt.sjs file. In the following example, we will print out the guixt.sjs file path:

println("guixt.sjs file path is" +_guixtsjs);


_guixtdll

The _guixtdll variable specifies the guixt.dll file path on your system. You can add a new version of this file in this path to access new features developed. In the following example we will print out the location of guixt.dll file path:

println("guixt.dll file path is"+_guixtdll);


_hostname

The _hostname variable is used to return the client PC name or computer name. This variable is useful for specifying the Client system information. To find the PC name, we would write the following:

println("The client PC name is >>" +_hostname);


_language

The _language variable is used to return the current language code of a given implementation. If users are operating in different languages, this variable is useful for specifying the different language files or different operations for different users based on language. To find the current language and output that information to the console, we would write the following:

println("The language is>>" +_language);


_last_fcode

The _last_fcode is a  variable used to return the last executed function code for which the client has processed. This command is used to capture the last executed function code in the ‘_last_fcode’ system variable. In the below example, the value of the ‘_last_fcode’ is printed on the Cornelius Output window.

println("The last entered tcode is>>" +_last_fcode);


_listcursorcol

The _listcursorcol system variable is used to find the column number wherever the cursor positioned on the list screen and to read the data from that position. In the following example, we will use this to obtain the column number on a list screen for the 'Material Document List' screen contained in the MB51 transaction.

println("The column number where the cursor positioned and its value on the list screen is>>" +_listcursorcol);


_listcursorrow

The _listcursorrow system variable is used to find the row number wherever the cursor positioned on the list screen and to read the data from that position. In the following example, we will use this to obtain the row number on a list screen for the 'Material Document List' screen contained in the MB51 transaction.

println("The row number where the cursor positioned and its value on the list screen is>>" +_listcursorrow);


_listfirstvisiblecol

The _listfirstvisiblecol system variable is used to specify the last column of a list screen that is visible to a user. This column value is changed when the table is scrolled. In the following example, we will use this to obtain the first visible column for ‘Blocked SD documents' screen contained in the VKM1 second screen. The code in the script file would be as follows:

println("First visible col is>>" + _listfirstvisiblecol);


_listlastvisiblecol

The _listlastvisiblecol system variable is used to specify the last column of a list screen that is visible to a user. This column value is changed when the table is scrolled. In the following example, we will use this to obtain the last visible column for the ‘Blocked SD documents’ list screen contained in the VKM1 transaction. The code in the RM06BL00.E0120.sjs script file would be as follows:

println("Last visible col is>>" + _listlastvisiblecol);


_listlastrow

The _listlastrow system variable is used to find the last row number of a table on the list screen. In the following example, we will use this to obtain the last row position on a list screen for the 'Material Document List' screen contained in the MB51 transaction.

println("The last row number on the list screen is>>" +_listlastrow);


_listdatawidth

The _ listdatawidth system variable is used to specify the width of the screen that is visible to a user. This width value is changed when it is viewed in mobile devices. In the following example, we will use this to obtain the list datawidth for ‘Blocked SD documents' screen contained in the VKM1 second screen. The code in the script file would be as follows:

println("Data Width of the list screen is>>" + _listdatawidth);


_listtotalwidth

The _listtotalwidth system variable is used to specify the total width of the table on a list screen. In the following example, we will use this to obtain the total width of the table for ‘Blocked SD documents' screen contained in the VKM1 second screen. The code in the script file would be as follows:

println("Total Width of the list screen is >>" + _listtotalwidth);


_listfirstvisiblerow

The _listfirstvisiblerow system variable is used to specify the first row of a list screen that is visible to a user. In the following example, we will use this to obtain the first visible row for the 'Assigned Source of Supply to Requisitions' list screen contained in the ME56 transaction. The code in the RM06BL00.E0120.sjs script file would be as follows:

println("First visible row is>>" + _listfirstvisiblerow);


_listlastvisiblerow

The _listlastvisiblerow system variable is used to specify the last row of a list screen that is visible to a user. In the following example, we will use this to obtain the last visible row for the 'Assigned Source of Supply to Requisitions' list screen contained in the ME56 transaction. The code in the RM06BL00.E0120.sjs script file would be as follows:

println("Last visible row is>>" + _listlastvisiblerow);


_liststring

The _liststring system variable is used to obtain the cursor's current position on the list screen; not the full content of the row where the cursor is. In the following example, we will use this to obtain the cursor's current position on the 'Assigned Source of Supply to Requisitions' list screen contained in the ME56 transaction. The code in the RM06BL00.E0120.sjs script file would be as follows:

println("Current cursor position is>>" + _liststring);


_listcursorrow

The system variable is used to find the position of the cursor in the list on the listscreen and to read the data from that position.

println("Display the cursor position: "+_listline);


_log

The _log variable displays its value as true or false. If the _log variable is set to true the log files get generated in this path (C:\Users\User_name\Liquid UI Log”). In the following example we will print out the _log variable value:

println("_log value is "+_log);


_message

The _message variable is used to return various SAP system messages. Various levels of messages can be defined; the default is to return everything. Status messages can be output either to the SAP screen or to the console. To see current messages in the console window, use the following:

println("Messages>>" +_message);


_msgno

_msgno is used to find the SAP message number. _msgno value can be used in error handling or to conditionalize the process. In our example, you can find the message number in the console window with the execution of the following code:

println("Message Number is>>" +_msgno);


_msgtype

_msgtype is used to find the type of SAP message. Message types are classified into three types and they are error type E, warning type W and welcome or success messages S. You can also use the _msgtype value in conditionalizing the functions for error handling. In our example, you can find the message type in the console window with the execution of the following code:

println("Message Type is>>" +_msgtype);


_msgid

The _message variable is used to return various SAP system messages. Various levels of messages can be defined; the default is to return everything. Status messages can be output either to the SAP screen or to the console. To see current messages in the console window, use the following:

println("Message id is>>" +_msgid);


_notificationID

The _notificationID system variable is used to return iOS and Android device token value through Liquid UI Server. Device token value is unique for a device and specifically used for push notification service. You can view different notificationID value for different devices using the following syntax:

println("notification id is>>" +_notificationID);


_nwrfcinuse

This variable is used to result "TRUE", when SAPNWRFC is used for RFC communication, and result "FALSE" when LibRFC is used for RFC communication. Liquid UI supports the latest RFC Libraries that are being deployed by SAP since SAPgui 750. The latest RFC Libraries that SAP deployed is called SAPNWRFC, and the file that is used is SAPNWRFC.DLL.

Based on the machine that SAPgui is installed, SAPNWRFC.DLL is installed,

32 Bit O.S. --> C:\Windows\System32

64 Bit O.S --> C:\Windows\SysWOW64

Note: Liquid UI supports _nwrfcinuse system variable from versions of Liquid UI for Desktop: 1.2.342.0 and above, Liquid UI for Server: 3.5.589.0 and above.

To find whether the SAPNWRFC library files are used and installed in your SAPgui folder, the following code can be used:

println("RFCLibrarys in use: "+_nwrfcinuse);


_page

The _page system variable is used to return the details of the tab on the SAP screen in the form of an array. You can view the tab label name, technical name and its function code in the array, and can retrieve its individual values using its index values 0, 1, 2 respectively. This variable retrieves the information of the active tab on the screen. You can use the tab id or technical name to conditionalize the scripts. To find the _page value on the console, we would write the following:

println("Display active tab details" +_page);
//Result: ["HeaderData","IHKZ","=IHKZ"] on IW32 second screen

You can also display the individual element of the array, we would write the following:

println("Display tab name" +_page[0]);
//Result:["Header Data"]


_page.exists

The _page.exists property is used to identify individual tabs in a transaction using either its label name or technical name. For example, the SAPMV45A.E4001 screen in the VA01 transaction has a number of tabs, as shown below:

With _page.exists, you can perform operations based on which tab of a given page is being edited, as shown in the following example:

if(_page.exists("Sales"))  {
set("F[Sold-to party]","1460");
}

You can also use _page.exists command to verify if a given tab or page is actually present as shown in the above example.


_program

Every dynpro has a program name associated with it, as shown in the following examples:

  • SAPMV45A
  • SAPLSMTR_NAVIGATION

The _program variable returns the program name for the current screen. To return the current program number to the console, the following code can be used:

println("Program>>" +_program);


_sapgui_version

The _sapgui_version variable specifies the SAP GUI version number of the given SAP server. Operations can be performed based on a particular system name. This is particularly useful when users are connecting to multiple SAP ERP systems. In the following example we will print out the SAP GUI Version:

println("SAP GUI Version is >>" +_sapgui_version);


_sapgui_patch

The _sapgui_patch variable specifies the SAP GUI patch level of the given SAP server. Operations can be performed based on a particular system name. This is particularly useful when users are connecting to multiple SAP ERP systems. In the following example, we will print out the SAP GUI Patch Level

println("SAP GUI Patch Level is >>" +_sapgui_patch);


_tabcol

This variable specifies the position of the cursor on the table column i.e on which column does the cursor appear on the table. In the following example, you can view how to access the _tabcol value.

println("Position of the cursor on table column is>>" + _tabcol);


_traceflags

The system variable is used to set the Traceflag in guixt.sjs during runtime using TRACEFLAGS. In the following example, we will use this to determine the layout.

println("_traceflags = FLG_VIVIEN_OUTPUT_FS_PRE_PRINT;);


_tabrow

This variable specifies the position of the cursor on the table row i.e on which row does the cursor appear. In the following example, you can view how to access the _tabrow value.

println("Position of the cursor on table row is>>" + _tabrow);


_tabrowabs

The _tabrowabs system variable is used to retrieve the absolute cursor row on the table.
By default, its value is 1.

In the following example we will print out the absolute position of the table row:

println("Absolute cursor row is:" +_tabrowabs);


_title

This variable retrieves the screen title where the user currently resides. An example is shown below:

println("Screen title is>>" + _title);


_transaction

This variable is used to identify individual SAP transactions. It differs from the '_page' variable in that it refers to the transaction ID, such as 'VA01' as opposed to the actual page, which could be something quite different. Operations can be performed based on the transaction ID, as shown in the following example:

if(_transaction=="va01")  {
  set("F[Order Type]","OR");
}


_version

The _version variable specifies the Liquid UI version number. Operations can be performed based on a particular Liquid UI Version. This is particularly useful when users are connecting to multiple SAP ERP systems. In the following example we will print out the Liquid UI Version number:

println("Liquid UI Version is >>" +_version);


_user

The _user variable specifies the current user. To find the user information and output it to Console, the following code can be used:

println("User>>" +_user);


_windowsize

This system variable provides information about the width and height of your SAP window in pixels.

title("Width: "+_windowsize_x+",Heigth: "+_windowsize_y);

Learn more about _windowsize.


Tips and Tricks

  • System Variable: _database

    This system variable holds a string value of the name of the database or system ID.

    if(_database == "TR1"){title("Welcome to ZEUS");}

    Learn more about System Variable: _database as how to conditionalize your scripts.

  • System Variable - _sessioncount

    This system variable returns the number of sessions/connections that are open in SAP.

    title("Session Count:"+_sessioncount);

    Learn more about System Variable - _sessioncount.

  • System Variables for an SAP message

    The system variables are used to return the message id, message number, and message type of an SAP message.

    println("Message: "+_message);
    println("Message Type: "+_msgtype);
    println("Message Number: "+_msgno);
    println("Message ID: "+_msgid);
    

    Learn more about System Variables for an SAP message.

  • System Variables for a list screen

    The system variables of a list screen return the first visible column, the last visible column, the total width of the table, data width of the list screen.

    println("List listfirstvisiblecol:" +_listfirstvisiblecol);
    println("List listlastvisiblecol:" +__listlastvisiblecol);
    println("List listtotalwidth:" +_listtotalwidth);
    println("List listdatawidth:" +_listdatawidth);

    Learn more about System Variables for a list screen.


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