<< Click to Display Table of Contents >> Navigation: 4. AddOn Components > MR Connect for use with SAP® > ! Smart Package Robot 's Addon for use with SAP® (Connect to SAP®) |
Smart Package Robot 's Addon's: MR Connect for use with SAP® (MCFS)
"MiniRobots Connect for use with SAP® " (In short: MCFS) is an AddOn which offers the possibility to connect the Smart Package Robot to SAP® GUI for Windows.
The communication between the SPR and the SAP® GUI for Windows is done via the SAP® GUI Scripting interface.
Therefore It is necessary to activate SAP® GUI Scripting, otherwise all commands from this AddOn would not work.
Important Hint:
This is an Third Party AddOn Component that is integrated into the SPR System as a AddOn.
It was developed by Stefan Schnell. Due to new developments from Stefan, the Add On will not need a separate License any more.
If a session is busy, it can't executes SAP® GUI Scripting. Each procedure inside "SPR Connect to SAP®" discovers the status of a session. If a session is busy, "Connect to SAP® " jumps over the command and will do nothing. In some cases you may get the timeout flag set.
Requirements
Operating system Windows 7 or higher.
Full standard installation of SAP GUI for Windows 7.30 or higher.
You need to enable GUI Scripting on Presentation Server, like this:
Choose the menu item Options... from the system menu of the SAP® Logon.
Choose the node Scripting.
Hint: It is better to disable the notifications, otherwise you got a requester for each script execution.
Sample-Script:
'-Begin-----------------------------------------------------------------
'-Variables-----------------------------------------------------------
VAR.$$DEB
VAR.$$FAK
VAR.$$PRC
VAR.$$PID
VAR.$$VRC
VAR.$$SES
VAR.$$BUS
VAR.$$CMD
VAR.$$WND
VAR.$$CON
VAR.$$SEI
'-Main------------------------------------------------------
'-Set DebugMode and FakeMode, only for testing--------------
SSP.SetDebugMode|1
SSP.SetFakeMode|1
SSP.GetDebugMode|$$DEB
MBX.$$DEB
SSP.GetFakeMode|$$FAK
MBX.$$FAK
'-Shows about message box-----------------------------------
GSP.About
'-Pings an SAP system---------------------------------------
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.
'-Checks if SAP GUI for Windows is installed----------------
ISP.SAPGUIInstalled
'-Checks if SAP Logon is loaded and start it if necessary---
NSP.SAPGUI Exists
GSP.SAPGUILaunch
$$PID=#pid#
MBX.PID of SAP Logon is $$PID
EIF.
'-Gets the SAP GUI Scripting version------------------------
GSP.ScriptingVersion|$$VRC
MBX.SAP GUI Scripting Version $$VRC
'-Checks if a connection exists-----------------------------
NSP.Connection Exists
MBX.Please open an SAP connection
EIF.
'-Gets the first free session of connection 0---------------
GSP.FirstFreeSession|0|$$SES
MBX.First free session is $$SES
CAL.$$SES=$$SES - 1
'-Checks if session is busy---------------------------------
GSP.SessionBusy|0|$$SES|$$BUS
IVV.$$BUS=1
MBX.Session $$SES of connection 0 is busy
ELS.
MBX.Session $$SES of connection 0 is not busy
EIF.
'-Executes a small script-----------------------------------
$$CMD=session.findById("wnd[0]/usr/txtRSYST-MANDT").text = "000" $crlf$
$$CMD=$$CMDsession.findById("wnd[0]/usr/txtRSYST-BNAME").text = "BCUSER" $crlf$
$$CMD=$$CMDsession.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "minisap" $crlf$
$$CMD=$$CMDsession.findById("wnd[0]/usr/txtRSYST-LANGU").text = "DE" $crlf$
$$CMD=$$CMDsession.findById("wnd[0]/tbar[0]/btn[0]").press $crlf$
GSP.ExecSub|0|$$SES|$$CMD
'-Gets window which uses transaction SE16-------------------
GSP.WhichWindowHas|Transaction|SE16|$$WND
MBX.Handle of the window is $$WND
'-Gets the first connection from user BCUSER----------------
GSP.WhichConnectionHas|User|BCUSER|$$WND
MBX.Handle of the window is $$WND
'-Gets the first session which runs report SAPLWB_INITIAL_TOOL--
GSP.WhichSessionHas|Program|SAPLWB_INITIAL_TOOL|$$WND
MBX.Handle of the window is $$WND
'-Gets the connection which contains the window handle 4711-
GSP.WhichConnectionhWnd|4711|$$CON
MBX.Connection is $$CON
'-Gets the session with the window handle 4711--------------
GSP.WhichSessionhWnd|4711|$$SEI
MBX.Session is $$SEI
ELS.
MBX.SAP GUI for Windows is not installed
EIF.
'-End-------------------------------------------------------
END.
Trademark/legal notice
SAP® and SAP® GUI Scripting are registered trademarks of SAP AG
Smart Package Robot and MiniRobot are properties of Theo Gottwald