GSP. - Get SAP® Data

<< Click to Display Table of Contents >>

Navigation:  4. AddOn Components > MR Connect for use with SAP® >

GSP. - Get SAP® Data

GSP. - Get Data from SAP®-Application

Previous Top Next


MiniRobotLanguage (MRL)

 

GSP. Command

Get Data from SAP®-Application

 

 

Intention

 

The GSP.-Command is the command to retrieve information from the SAP®-System via SPR-Skript. It has multiple options that makes automation easier then ever before.

 

Usage is simple:

 

GSP.(subcommand)|(one or more parameters)|(Variable with result of operation)

 

 

 

 

 

 

Syntax

 

 

GSP.subcommand[|P1][|P2][|P3]

 

 

Parameter Explanation

 

These general Rules apply:

 

1. If you omit the Variable for the Result of the command, the result will be stored on the stack.

 

2. Session numbers are counted from 1 to 6 as usual.

 

3. If you omit the connection number, a 1 is used as default number.

 

4. If there was a problem a session number of zero may be returned and the timeout flag will be set. Otherwise the timeout flag will be cleared.

 

5. All Subcommands have a long name that is better readable, and a short abbreviation that saves you typing. You can choose which one you prefer.

 

 

The following subcommands are currently supported:

 

"About","a."

Shows a messagebox with information about "Connect to SAP® ".

This command needs and accepts no parameter.

Example:

 

GSP.about

 

 

"FirstFreeSession","ffs."

Delivers the first session number of the given connection which is not busy.

Example:

 

' $$CON - Number of SAP® connection

' $$RES - Result of Operation

'

GSP.ffs.|$$CON|$$RES

 

GSP.FirstFreeSession|5|$$SES

MBX.First free session of connection 5 is $$SES

 

 

 

"ExecScript","ExecSub","exs."

Executes SAP® GUI Scripting code without a return value. Example:

 

' $$CON = Number of SAP® connection

' $$SES = Number of SAP® session

' $$CMD = SAP® GUI Script code

'

GSP.exs.|$$CON|$$SES|$$CMD

 

$$CMD=session.findById("wnd[0]/usr/txtRSYST-MANDT").text = "000"

$$CMD=$$CMD$crlf$

$$CMD=$$CMDsession.findById("wnd[0]/usr/txtRSYST-BNAME").text =

$$CMD=$$CMD"BCUSER" $crlf$

$$CMD=$$CMDsession.findById("wnd[0]/usr/pwdRSYST-BCODE").text =

$$CMD=$$CMD "minisap" $crlf$

$$CMD=$$CMDsession.findById("wnd[0]/usr/txtRSYST-LANGU").text = "DE"

$$CMD=$$CMD$crlf$

$$CMD=$$CMDsession.findById("wnd[0]/tbar[0]/btn[0]").press $crlf$

 

GSP.ExecSub|0|0|$$CMD

 

 

 

"Ping","p."

Sends a ping to a SAP® system.  You need to specify these arguments:

If the ping is successful the return value is 1, otherwise 0.

If an error occurs the return value is -1.

Example:

' $$SAC - SAPClient = Number OF the CLIENT (Mandant)

' $$USN - SAPUser = NAME OF the USER

' $$SAW - SAPPassWord = Password OF the USER

' $$SAL - SAPLanguage = Language, e.g. DE OR EN.

' $$SID - SAPSystem = System ID (SID)

' $$SAH - SAPHostName = NAME OF the HOST (Application SERVER)

' $$SSN - SAPSystemNumber = Number OF the system (INSTANCE number)

' $$RES - Variable for Result

'

GSP.Ping|$$SAC|$$USN|$$SAW|$$SAL|$$SOD|$$SAH|$$SSN|$$RES

 

GSP.Ping|000|BCUSER|minisap|DE|NSP|192.168.145.130|0|$$PRC

IVV.$$PRC=1

     MBX.Ping successful

ELS.

     MBX.Ping not successful

EIF.

 

 

"SapGuiLaunch","sl."

Starts the program saplogon.exe or saplgpad.exe, which are the base of the SAP® GUI for Windows®. If the start is successful the return value is the process ID (PID) of the program, otherwise 0. #PID# is set by this command to the PID or if an error happened to zero..

Example:

 

GSP.sl.

 

 

"ScriptingVersion","sv."

Delivers the SAP® GUI Scripting version. The SAP® GUI Scripting version as string, e.g. 7300.249. The first number is the major and the second number is the minor version.

Example:

 

' Version number will be on TOS

GSP.sv.

' Version number will be in Variable

GSP.sv|$$RES

 

 

"SessionBusy","sb."

Checks if the session is busy. If the specified SAP® session is busy the return value is 1, otherwise 0. Example:

 

' $$CON = Number of the SAP® connection

' $$SES = Number of the SAP® session

' $$RES - Variable for Result

'

GSP.sb.|$$CON|$$SES|$$RES

 

 

"WhichConnectionHas","wch."

Delivers the connection number of first connection with the given property.Number of the connection, otherwise -1. If the session is busy, this function returns -1.

Example:

'

' $$PRO = Property

' $$VAL = Value of Property

' $$RES - Variable for Result

'

GSP.wch.|$$PRO|$$VAL|$$RES

 

 

"WindowToConnection","wtc.","WhichConnectionHwnd"

Delivers the connection number of the given window handle, or in case of error -1.

Example:

'

' $$HWN = Handle of a Window

' $$RES - Variable for Result

'

GSP.wtc.|$$PRO|$$RES

 

 

"WhichSessionHas","wsh."

Delivers the session number of first session (1-6) with the given connection and property, otherwise 0. Example:

'

' $$PRO = Property

' $$VAL = Value of Property

' $$RES - Variable for Result

'

GSP.wtc.|$$PRO|$$VAL|$$RES

 

 

"WindowToSession","wts.","WhichSessionHwnd"

Delivers the session number of the given window handle, or in case of error  -1.

If you omit $$HWN the actual window is used.

If the command can not evaluate a valid window handle (no localized window and no handle given

Example:

 

' $$VAL = Value of Property

' $$RES - Variable for Result

'

GSP.wts.|$$HWN|$$RES

' If you omit $$HWN the actual window is used.

GSP.wts.||$$RES

' If you omit $$RES the TOS will contain the result

GSP.wts.

 

 

"WhichWindowHas","wwh."

Delivers the handle of first session window with the given property.Handle of the session window, otherwise 0. Example:

'

' $$PRO = Property

' $$VAL = Value of Property

' $$RES - Variable for Result

'

GSP.wwh.|$$PRO|$$VAL|$$RES

 

GSP.WhichConnectionHas|User|BCUSER|$$WND

MBX.Handle of the window is $$WND

 

 

 

"DebugMode","dm."

Delivers the actual debugging state of the MRCS-AddOn.

For internal use only. Example:

 

GSP.dm.|$$RET

 

 

"FakeMode","fm."

Delivers the actual FakeMode state of the MRCS-AddOn.

For internal use only. Example:

 

GSP.fm.|$$RET

 

 

 

P1..Px - (optional) depending on the subcommand, there may be no or multiple parameters needed.

 

 

 

 

Examples

 

GSP.WhichConnectionhWnd|4711|$$CON

MBX.Connection is $$CON

END.

 

$$WND = 4711

GSP.WhichConnectionhWnd|$$WND|$$CON

GSP.WhichSessionhWnd|$$WND|$$SES

MBX.Window with handle $$WND is connection $$CON and session $$SES

END.

 

GSP.WhichSessionHas|Program|SAPLWB_INITIAL_TOOL|$$WND

MBX.Handle of the window is $$WND

END.

 

GSP.WhichSessionhWnd|4711|$$SES

MBX.Session is $$SES

END.

 

$$WND = 4711

GSP.WhichConnectionhWnd|$$WND|$$CON

GSP.WhichSessionhWnd|$$WND|$$SES

MBX.Window with handle $$WND is connection $$CON and session $$SES

END.

 

GSP.WhichWindowHas|Transaction|SE16|$$WND

MBX.Handle of the window is $$WND

END.

 

GSP.SessionBusy|0|0|$$BUS

IVV.$$BUS=1

   MBX.Session 0 of connection 0 is busy

ELS.

   MBX.Session 0 of connection 0 is not busy

EIF.

END.

 

 

 

Remarks

 

Some of these Sub-commands will set the timeout-flag if the operation was not successful.

 

You get the arguments for the PING Subcommand as follows:

 

graphic

 

 Also you get the information from the property item from the system of the SAP

 logon program.

 

graphic

 

 Important hint:

 Ping uses the ANSI version of the SAP® GUI ActiveX Controls.

 

 

 

 

 

Limitations:

 

If a session is busy, it can't executes SAP® GUI Scripting. Each procedure inside MCFS discovers the status of a session. If a session is busy, "Connect to SAP® " jumps over the command and will does nothing. In some cases you may get the timeout flag set.

 

 

 

See also:

 

    ! Smart Package Robot 's Addon for use with SAP® (Connect to SAP®)

    ISP. / NSP. - If SAP® State

    WSP. - Wait for SAP® State

    SSP. - Set SAP® Data