Liquid UI - WS Reference Library

WS System Variables


Purpose

Within the WS platform we have a number of system variables that can be used for the variety of tasks.

Following system variables are supported in all released versions of WS and are as follows:


_ashost

The _ashost variable specifies the actual server name 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 server:

println("Host>>" +_ashost);


_client

The _client variable can be used to find data on any user in the system. In our example, to find the current user, and then output that information to the console window, follow the below code:

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


_clientedition

The _clientedition variable is used to gather information about the client side 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 in 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 if 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 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'.

Learn more about _clientedition.


_connectiondata

This feature can be used only with GuiXT Web Server.

The '_connectiondata' system variable is used to enable scripts to access URL queries and pass them as parameters to Web Server. This is particularly useful when passing 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 'sampleuser'.

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 'samplepass'.

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 wil 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 perfrom 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.


_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);


_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);


_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);


_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);


_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 in 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 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);


_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 can be 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 console window with the execution of following code:

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


_msgtype

_msgtype can be 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 console window with the execution of 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);


_page.exists

The _page.exists property is used to identify individual tabs in a transaction. 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 the _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):


_title

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

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


_transaction

The _transaction 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");
}


_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 what the name of the database or system ID is.

    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 as how many sessions/connections are open in SAP.

    title("Session Count:"+_sessioncount);

    Learn more about System Variable - _sessioncount.

  • System Variables for a SAP message

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

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

    Learn more about System Variables for a SAP message.

  • System Variables for a list screen

    The system variables of a list screen returns first visible column, last visible column, totalwidth of the table, datawidth 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.