Sign in to follow this  
Followers 0
mredtamu

SAP System Messages causing issues with AutoIt

1 post in this topic

I have a set of scripts that basically log into SAP and run a transaction. They normally work great, but around the end of the month, we typically have system messages posted (where someone sends a message to every user that pops up prior to allowing anything else to be done). These pause the autoit script, and I haven't found a good way to work around them, mostly because they only pop up once a month, and once you acknowledge it, they never reappear. Below is an example script.

Has anyone come up with a solution to this?

Thanks!

Charles

#include <SAP.au3>

$username = "Username"
$password = "Password"

$SAPVersion = "SAP Logon 640"
run("C:\Program Files\SAP\FrontEnd\SAPgui\SAPlogon.Exe")
Sleep(2000)
if WinActive($SAPVersion) = False Then
$SAPVersion = "SAP Logon 710"
EndIf

$sapgui = ObjGet("SAPGUI")
$sapapp = $sapgui.GetScriptingEngine
$sapapp.openConnection("D50 [SAPPUBLIC]")
_SAPSessAttach("SAP")
_SAPObjValueSet("usr/txtRSYST-BNAME",$username)
_SAPObjValueSet("usr/pwdRSYST-BCODE",$password)
send("{Enter}")

if not WinActive("SAP Easy Access","") Then
WinActivate("SAP Easy Access","")
WinWaitActive("SAP Easy Access","")
EndIf
;tell it which transaction to run
_SAPSessAttach("SAP Easy Access")
$sap_session.findById("wnd[0]/tbar[0]/okcd").text = "/nCA51"
_SAPVKeysSend("Enter")

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0