on 05-22-2005 12:08 AM
I am able to record, run and understand the SAPGUI Script when I am already loggedon the SAP System. Could anyone help me or provide me an example where I can code the script to open a session and logon to SAP system (Using SAP Logon) and than execute the recorded transaction.
Thanks in advance.
_M
I've been pretty successful doing this with an Excel macro to run various transactions. Is this what you had in mind?
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Christian,
Your code works very well with Visual Basic 6. Do you know how it should looks like for VB.NET? VB.NET doesnt accept fourth line:
Set Session = connection.children(0)
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Thanks Ben and Jonathan for responding. I am still struggling with the openConnection method. Any example would help. If you happen to open SAPR/3 Session from scratch using this method and logon also, please provide some more information.
So far, thanks for the help.
_Manoj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Manojy,
below is a sample script. The first parameter is a description text from the SAPLogon dialog, the second sets the syncronous mode for OpenConnection. This means that the call will only return when a connection has been successfully made or the attempt has failed.
The last three line set username and password, which you only need to do if you do not have Single Sign On.
This example assumes that you already have saplogon.exe running. If this is not the case, than you can create a SAP GUI instance by calling
Set application = CreateObject("Sapgui.ScriptingCtrl.1")
Best regards,
Christian
Set SapGui = GetObject("SAPGUI")
Set application = SapGui.GetScriptingEngine
Set connection = application.OpenConnection("XYZ [PUBLIC]", True)
Set Session = connection.children(0)
session.findById("wnd[0]/usr/txtRSYST-BNAME").text = "MyUsername"
session.findById("wnd[0]/usr/pwdRSYST-BCODE").text = "MyPassword"
session.findById("wnd[0]").sendVKey 0
Hi Christian,
I try to launch SAPGUI with a script. However the script block on below code lines
<<Set SapGui = GetObject("SAPGUI")>>
<<Set application = SapGui.GetScriptingEngine>>
and display the error message <<The enumerator of collection cannot find an element with the specified index.>>
Do you know what is the issue and how to by-pass it? I have written several scripts and I always get the same message.
Thanks & Best Regards
Francois,
Hi,
I am searching for a way to login through SAP GUI. This post seemed like an answer to my question.
I noticed you are using a session object to enter a username and password.
I was attempting a similar way of logging in with the difference being that I open a connection using the SAP GUI. My understanding is that opening a connection using SAP GUI is the same as OpenConnection call in the script. Then I attempt to enumerate sessions using scripting.
The problem I am facing is that I get zero sessions. Since there does not appear to be a way to get to user controls without a session, how can I enter username and password? Why is there zero sessions?
Thank you,
Michael.
The openConnection() method of the GuiApplication object will start a system "from scratch". You pass the name of an entry from your SAP Logon to it.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I do not think it is possible to use eCATT SAPGUI to actually open the SAP logon pad and launch a new session, however, if you want to test roles and security you can use RFCs to logon to a specified system with a username and password. There are other ways to test the login process but it really depends on what aspect of the system you are trying to test.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.