Sign in to follow this  
Followers 0
sc4ry

SAP Login Script

8 posts in this topic




Hey,

i search for a SAP login script. do anybody know, if somebody has already written such a script?

here are 2 pics

http://www.autoit.de/attachment.php?attachmentid=1168

http://www.autoit.de/attachment.php?attachmentid=1169

script should catch the specified stage (pic1) and after that login with user and pw (pic2)

Hi, I'm not an expert on this, and I could not test this yet, but I believe something like this should do the logon (using dcom):

Global $LogonControl = ObjCreate("SAP.LogonControl.1")
$g_oConnection = $LogonControl.NewConnection
$g_oConnection.System = "R30" ;Name of your R/3 System
$g_oConnection.ApplicationServer = "hs2001" ;Applic.Server of R/3 System
$g_oConnection.SystemNumber = 0 ;SystemNumber of your R/3 System

;***User specific data
$g_oConnection.User = "MyUserName"
$g_oConnection.Password = "secret"
$g_oConnection.Client = "000"
$g_oConnection.Language = "E"
$connect = $g_oConnection.Logon
If $connect = True Then
    MsgBox(64, "Connection", "R/3 connection was successfull")
Else
    MsgBox(64, "Connection", "Something went wrong!")
EndIf

The SAP COM interface is documented at this link - I hope I could help! :rolleyes:


[topic="51913"]Restrict USB Storage usage to group membership[/topic] * [topic="48699"]Using nircmd library[/topic] * Some admin notes

Share this post


Link to post
Share on other sites

thank you... on first look it looks good, but i will try it today.

hope it will work fine =)

Share this post


Link to post
Share on other sites

thank you... on first look it looks good, but i will try it today.

hope it will work fine =)

Hello again. Now I've tested it and this works for unattended login:

Global $LogonControl = ObjCreate("SAP.LogonControl.1")
$g_oConnection = $LogonControl.NewConnection
$g_oConnection.System = "XXX" ;Name of your R/3 System
$g_oConnection.ApplicationServer = "server.domain" ;Applic.Server of R/3 System
$g_oConnection.SystemNumber = 02 ;SystemNumber of your R/3 System
 
;***User specific data
$g_oConnection.User = "UserName"
$g_oConnection.Password = "password"
$g_oConnection.Client = "011"
$g_oConnection.Language = "EN"
$connect = $g_oConnection.Logon(0, True); use false to show the login window

If $connect = True Then
    MsgBox(64, "Connection", "R/3 connection was successfull")
Else
    MsgBox(64, "Connection", "Something went wrong!")
EndIf

Maybe we can build some SAP UDF's :whistle:


[topic="51913"]Restrict USB Storage usage to group membership[/topic] * [topic="48699"]Using nircmd library[/topic] * Some admin notes

Share this post


Link to post
Share on other sites

hey ... ok, script told me, that the R/3 connection was successfull .... whatever this means *g*

there is the login window, filled with my details. but where is sap oO

if i understand any COM, i would help you with some SAP UDFs, but at the moment i don´t get it =)

but thank you again, i will test it more and have a look, if i could really need it ....

Share this post


Link to post
Share on other sites

I thought you wanted to program something (if I connect to SAP with AutoIT it have to be this way!)

Well, if you just want to send keystrokes - open SciTE, in the tools menu, AU3Recorder... then change the code to whatever you like.


[topic="51913"]Restrict USB Storage usage to group membership[/topic] * [topic="48699"]Using nircmd library[/topic] * Some admin notes

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

Maybe we can build some SAP UDF's :)

I'm working on it BullGates. I'll be submitting a SAP UDF to the forums shortly I hope. It uses the SAP GUI Scripting COM object and so far is great at automating SAP for me.

I've also written AutoIT scripts and functions that use the core windows and keyboard functions to interact with SAP windows, though they are not as fast as using the SAP COM object.

Edited by seangriffin

Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia

Share this post


Link to post
Share on other sites

I have submitted my SAP UDF:

SAP UDF, Automating SAP using SAP's GUI Scripting COM object

Hope this helps all you SAP scripters out there :)


Cheers, Sean.

See my other UDFs:

Chrome UDF - Automate Chrome | SAP UDF - Automate SAP | Java UDF - Automate Java Applications & Applets | Tesseract (OCR) UDF - Capture text from applications, controls and the desktop | Textract (OCR) UDF - Capture text from applications and controls | FileSystemMonitor UDF - File, Folder, Drive and Shell Monitoring | VLC (Media Player) UDF - Creating and controlling a VLC control in AutoIT | Google Maps UDF - Creating and controlling Google Maps (inc. GE) in AutoIT | SAPIListBox (Speech Recognition) UDF - Speech Recognition via the Microsoft Speech (SAPI) ListBox | eBay UDF - Automate eBay using the eBay API | ChildProc (Parallel Processing) UDF - Parallel processing functions for AutoIT | HyperCam (Screen Recording) UDF - Automate the HyperCam screen recorder | Twitter UDF - Automate Twitter using OAuth and the Twitter API | cURL UDF - a UDF for transferring data with URL syntax

See my other Tools:

Rapid Menu Writer - Add menus to DVDs in seconds | TV Player - Automates the process of playing videos on an external TV / Monitor | Rapid Video Converter - A tool for resizing and reformatting videos | [topic130531]Rapid DVD Creator - Convert videos to DVD fast and for free | ZapPF - A tool for killing processes and recycling files | Sean's eBay Bargain Hunter - Find last minute bargains in eBay using AutoIT | Sean's GUI Inspector - A scripting tool for querying GUIs | TransLink Journey Planner with maps - Incorporating Google Maps into an Australian Journey Planner | Automate Qt and QWidgets | Brisbane City Council Event Viewer - See what's going on in Brisbane, Australia

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