IBM Rational Functional Tester
Version 8.1.1000
IBM Rational Functional Tester API Reference

Project Version 2.3

com.rational.test.ft.object.interfaces.SAP
Class SAPGuiSessionTestObject

java.lang.Object   extended by com.rational.test.ft.object.interfaces.TestObject
      extended by com.rational.test.ft.object.interfaces.SAP.SAPGuiSessionTestObject

public class SAPGuiSessionTestObject
extends TestObject

A TestObject representing a SAPGUI Scripting GuiSession object.The GuiSession provides the context in which a user performs a certain task such as working with a transaction. It is therefore the access point for applications which record a user’s actions regarding a specific task or play back those actions.

GuiSession is self-contained in that ids within the context of a session remain valid independently of other connections or sessions being open at the same time. Usually an external application will first determine with which session to interact. Once that is clear, the application will work more or less exclusively on that session. Traversing the object hierarchy from the GuiApplication to the user interface elements, it is the session among whose children the highest level visible objects can be found. In contrast to objects like buttons or text fields, the session remains valid until the corresponding main window has been closed, whereas buttons, for example, are destroyed during each server communication.


Field Summary
 
Fields inherited from class com.rational.test.ft.object.interfaces.TestObject
ref
 
Constructor Summary
SAPGuiSessionTestObject(com.rational.test.ft.object.map.SpyMappedTestObject mappedObject)
          For internal use.
SAPGuiSessionTestObject(com.rational.test.ft.object.map.SpyMappedTestObject mappedObject, TestObject anchor)
          For internal use.
SAPGuiSessionTestObject(com.rational.test.ft.object.map.SpyMappedTestObject mappedObject, TestObject anchor, long scriptCommandFlags)
          For internal use.
SAPGuiSessionTestObject(TestObject obj)
          Constructs one TestObject from another.
SAPGuiSessionTestObject(com.rational.test.ft.object.TestObjectReference ref)
          For internal use.
 
Method Summary
 void createSession()
          This function opens a new session, which is then visualized by a new main window.
 void endTransaction()
          Ends a transaction
 TestObject findById(java.lang.String id)
          Locates a descendant object in the SAPGUI Scripting hierarchy with the matching id.
 TestObject findByPosition(int x, int y)
          Finds a descendant SAPGUI Scripting element at the given position
 java.util.Hashtable getSessionInfo()
          Get technical information about the session.
 java.lang.String getVKeyDescription(int vKey)
          translate the integer representation of a SAPGUI vKey (used in SendVKey) to a meaningful string value.
 java.lang.Object invoke(java.lang.String method)
          Invokes a method with no args on the object in the software under test.
 java.lang.Object invoke(java.lang.String method, java.lang.String methodSignature, java.lang.Object[] args)
           Invokes a method on the object in the software under test.
 void sendCommand(java.lang.String command)
          Execute a SAP command.
 void startTransaction(java.lang.String transaction)
          Starts an SAP transaction
 
Methods inherited from class com.rational.test.ft.object.interfaces.TestObject
compare, compare, compareAndLog, compareAndLog, equals, exists, find, find, find, findAndInvoke, findAndInvoke, findAndInvokeProxy, getActualData, getChildren, getDescribedObject, getDescribedObjects, getDescriptiveName, getDomain, getField, getIndexer, getIndexer, getIndexers, getMappableChildren, getMappableParent, getMapProperties, getMethods, getNameInScript, getNonValueProperties, getObjectClassName, getObjectCustomClassName, getObjectReference, getOwnedObjects, getOwner, getParent, getProcess, getProperties, getProperty, getPropertyFromMap, getRecognitionProperties, getRecognitionPropertyWeight, getScriptCommandFlags, getStandardProperties, getTestData, getTestDataTypes, getTopMappableParent, getTopParent, hashCode, invokeProxy, invokeProxy, isMappedObject, isSameObject, isScreenTestObject, isTopLevelTestObject, performTest, performTest, performTest, performTest, setIndexer, setIndexer, setMapProperties, setProperty, toString, unregister, updateTestData, waitForExistence, waitForExistence
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

SAPGuiSessionTestObject

public SAPGuiSessionTestObject(com.rational.test.ft.object.map.SpyMappedTestObject mappedObject)
For internal use.


SAPGuiSessionTestObject

public SAPGuiSessionTestObject(com.rational.test.ft.object.map.SpyMappedTestObject mappedObject,                                TestObject anchor)
For internal use.


SAPGuiSessionTestObject

public SAPGuiSessionTestObject(com.rational.test.ft.object.map.SpyMappedTestObject mappedObject,                                TestObject anchor,                                long scriptCommandFlags)
For internal use.


SAPGuiSessionTestObject

public SAPGuiSessionTestObject(com.rational.test.ft.object.TestObjectReference ref)
For internal use.


SAPGuiSessionTestObject

public SAPGuiSessionTestObject(TestObject obj)
Constructs one TestObject from another. Both are references to the same Object.

Method Detail

invoke

public java.lang.Object invoke(java.lang.String method)
Invokes a method with no args on the object in the software under test.

Overrides:
invoke in class TestObject
Parameters:
method - The name of the method to be called
Returns:
An object of type java.lang.Object
Detail description:
Invokes a method with no args on the object in the software under test. Note that this can directly modify the object in the software under test and therefore should be done with extreme care. Whenever possible, you should avoid using invoke, which allows you to modify the software under test in ways that a typical user cannot. If you use this method, you should be sure to discuss its use with the developers of the software you are testing.

If the returned object is not a value class, invoke registers the object and returns a reference to the object in the software under test. As always, registered object references should be released by calling one of the unregister methods.

Since:
RFT 7.0
See Also:
invoke(String,String,Object[]), TestObject.unregister(), RationalTestScript.unregister(Object[]), RationalTestScript.unregisterAll(), RationalTestScript.getRegisteredTestObjects()

invoke

public java.lang.Object invoke(java.lang.String method,                                java.lang.String methodSignature,                                java.lang.Object[] args)
Invokes a method on the object in the software under test.

Overrides:
invoke in class TestObject
Parameters:
method - the name of the method to be called
methodSignature - the signature of the method to be called (using standard JNI syntax)
args - the arguments to be passed to the method
Returns:
An object of type java.lang.Object
Detail description:
Invokes a method on the object in the software under test. Note that this can directly modify the object in the software under test. You should therefore be extremely careful when you do this. Whenever possible, avoid using Invoke, which allows you to modify the software under test in ways that a typical user cannot. If you use this method, be sure to discuss its use with the developers of the software you are testing.

If the returned object is not a value class, invoke registers the object and returns a reference to the object in the software under test. Registered object references are released by calling one of the unregister methods.

The methodSignature uses JNI syntax to describe the parameter types and optionally the return value types for the method. The general syntax has the parameter types in parentheses, followed by the return type: (parameterTypes)returnType. Note that the returnType is not a required part of the signature - it can be omitted. There are specific encodings for the primitive types, and then a general encoding for class types.

CodeType
Zboolean
Bbyte
Cchar
Sshort
Iint
Jlong
Ffloat
Ddouble
Vvoid
Lfully-qualified-class;For example: Ljava.lang.string;

In addition, arrays are specified by combining the brace character '[' with another type. For example, [I is an array of integers, [[I is an array of arrays of integers and [Ljava.lang.Object; is an array of Objects. Another example:

void myMethod(long n, string s, int[] arr)

has the following signature:

(JLjava.lang.string;[I)V
Since:
RFT 7.0
See Also:
TestObject.unregister(), RationalTestScript.unregister(Object[]), RationalTestScript.unregisterAll(), RationalTestScript.getRegisteredTestObjects()

findById

public TestObject findById(java.lang.String id)
Locates a descendant object in the SAPGUI Scripting hierarchy with the matching id.

Parameters:
id - The id of the object to locate
Returns:
A TestObject representing the located SAPGUI Scripting object, or NULL if one could not be located.
Detail description:
Search through the object's descendants for a given id. If the parameter is a fully qualified id, the function will first check if thecontainer object's id is a prefix of the id parameter. If that is the case, this prefix is truncated. If no descendant with the given id can be found a NULL is returned.
Example:
Unless there are several sessions or connections in use, the following calls are equivalent:

SAPGuiTextTestObject to = SAPGuiSessionTestObject.findById("/app/con[0]/ses[0]/wnd[0]/usr/txtHEADER-FBFOOTLINE")

SAPGuiTextTestObject to = SAPGuiSessionTestObject.findById("txtHEADER-FBFOOTLINE")

Since:
RFT 7.0

sendCommand

public void sendCommand(java.lang.String command)
Execute a SAP command.

Parameters:
command - The command string to execute
Detail description:
Use this function you can execute any command string, which could otherwise be entered in the command field combobox
Example:
SAPGuiSessionTestObjet.sendCommand("PB10")
Since:
RFT 7.0

createSession

public void createSession()
This function opens a new session, which is then visualized by a new main window.

Since:
RFT 7.0

startTransaction

public void startTransaction(java.lang.String transaction)
Starts an SAP transaction

Parameters:
transaction - The SAP transaction
Detail description:
Calling this function with parameter "xyz" has the same effect as SendCommand("/nxyz").
Since:
RFT 7.0

endTransaction

public void endTransaction()
Ends a transaction

Detail description:
Calling this function has the same effect as SendCommand("/n").
Since:
RFT 7.0

getVKeyDescription

public java.lang.String getVKeyDescription(int vKey)
translate the integer representation of a SAPGUI vKey (used in SendVKey) to a meaningful string value.

Parameters:
vKey - the integer vKey
Returns:
The string representation of the vKey
Detail description:
When a script is recorded, it will often contain sendVKey(n) calls, where n is a number. The method getVKeyDescription translates these numbers into a readable text. For example the number 0 is translated into the text “Enter
Since:
RFT 7.0

getSessionInfo

public java.util.Hashtable getSessionInfo()
Get technical information about the session.

Returns:
SessionInfo as java.util.Hastable
Detail description:
Some of its properties are displayed in the right corner of the SAP GUI status line. Properties include: ApplicationServer: The name of the application server is set only if the session belongs to a connection that was started without load balancing, by specifying an application server.

Client: The client selected on the login screen.

Codepage: The codepage specified in SAPlogon in the properties of the connection.

Flushes: The property flushes counts the number of flushes in the automation queue during server communication.

Group: The login group information is available only if the session belongs to a connection which was started using load balancing.

GuiCodepage: A list of codepages is available in table TCP00A of the SAP system. On a client running Microsoft Windows with codepage 1252 (Latin I) the property guiCodepage is 1160.

I18NMode: The I18N mode of SAP GUI is required for multi-byte character sets.

InterpretationTime: The interpretation time begins after the data have arrived from the server. It comprises the parsing of the data and distribution to the SAP GUI elements. The unit is milliseconds.

IsLowSpeedConnection: The property is True if the connection to which the session belongs runs with the low speed connection flag. This flag can be set on the advanced connection properties page of the SAPLogon dialog. The SAP GUI Scripting support is very limited for low speed connections, because information required to identify SAP GUI objects is not being sent.

Language: The language specified on the login screen.

MessageServer: The message server information is available only if the session belongs to a connection which was started using load balancing.

Program: The name of the source program that is currently being executed.

ResponseTime: This is the time that is spent on network communication from the moment data are sent to the server to the moment the server response arrives. The unit is milliseconds.

RoundTrips: Before SAP GUI sends data to the server it locks the user interface. In many cases it will not unlock the interface once data arrive from the server, but instead will send a new request to the server immediately. Controls in particular use this technology to load the data they need for visualization. The count of these token switches between SAP GUI and the server is the roundTrips property.

ScreenNumber: The number of the screen currently displayed.

ScriptingModeReadOnly: The read only mode can be enabled using an application server profile parameter. In this mode the state of SAP applications can not be changed through the Scripting API, which means: Properties can only be read, but not set Functions can only be called if they do not change the control’s state.

ScriptingModeRecordingDisabled: The recording disabled mode can be enabled using an application server profile parameter. In this mode SAP GUI Scripting does not fire any events. This implies that user interaction can not be recorded. However data can be read from SAP GUI and scripts can be used to run transactions.

SessionNumber: The number of the session is also displayed in SAP GUI on the statusbar.

SystemName: This is the name of the SAP system.

SystemNumber: The system number is set only if the session belongs to a connection that was started without load balancing, by specifying an application server.

SystemSessionId: All SAP GUI sessions of the same connection are represented on the server with the same SystemSessionId. Using SystemSessionId and SessionNumber, it is possible to find a matching SAP GUI session from an ABAP application.

Transaction: The transaction that is currently being executed.

User: The SAP name of the user logged into the system.

Since:
RFT 7.0

findByPosition

public TestObject findByPosition(int x,                                  int y)
Finds a descendant SAPGUI Scripting element at the given position

Parameters:
x - the x coord
y - the y coord
Returns:
A TestObject located at the given point, or NULL if one does not exist.
Detail description:
This method can be used to do a hittest on a SAP GUI session. The parameters x and y should be given in screen coordinates. If no component is found a NULL is returned
Since:
RFT 7.0