Connect to SAP INES system


I am trying to connect to a SAP system from Excel VBA and am getting an error on the line
Set SapGuiApp = CreateObject
What software do I need on my machine to connect to a SAP INES system
I don't know a lot about connecting to online SAP test systems so need a little guidance

Sub Logontrial()
Dim SapGuiApp As Object
Dim oConnection As Object
Dim session As Object
Dim SAPCon As Object, SAPSesi As Object
Dim SAPGUIAuto As Object, SAPApp As Object
'Dim sapConnection As Object

If SapGuiApp Is Nothing Then
    Set SapGuiApp = CreateObject("Sapgui.ScriptingCtrl.1")
End If
If oConnection Is Nothing Then
    Set oConnection = SapGuiApp.OpenConnection("110 PRD-P01 ECC", True)
End If
If SAPSesi Is Nothing Then
   Set SAPSesi = oConnection.Children(0)
End If
 'sapConnection.Client = "100"
 'sapConnection.User = "USER"
 'sapConnection.Password = "PASSW"
 'sapConnection.Language = "EN"
 'If nsapConnection.Logon(1, True) = True Then
 '  MsgBox "No connection to R/3!"
 'End If
    'Set SAPCon = SAPApp.Children(0)
    'Set SAPSesi = SAPCon.Children(0)
    Application.DisplayAlerts = False
 With SAPSesi
    .findById("wnd[0]/usr/txtRSYST-MANDT").Text = "100"
    .findById("wnd[0]/usr/txtRSYST-BNAME").Text = "USER"
    .findById("wnd[0]/usr/pwdRSYST-BCODE").Text = "PASSW"
    .findById("wnd[0]/usr/txtRSYST-LANGU").Text = "EN"
    .findById("wnd[0]").sendVKey 0
    'start extraction
    .findById("wnd[0]/tbar[0]/okcd").Text = "/NZGLLISTBRULE"
    .findById("wnd[0]").sendVKey 0
    End With
     Application.DisplayAlerts = True
     MsgBox "After clicking OK, this SAP session is terminated."
End Sub
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
MurpheyConnect With a Mentor Application ConsultantCommented:
I don 't think that they let you connect to a demo server with VB (need ODBC to do that)
MurpheyApplication ConsultantCommented:
On what type of Hardware is SAP running?
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
I was told that there are demo versions of SAP in the cloud that anyone can connect to
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Thanks. Do you have any code or links on this.
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
sap user scripting is just using the gui. Check the gui install to make sure you have all the front end components.

I am not sure IDES will limit scripting.

tcode rz11 and enter sapgui/user_scripting, check to see if it is there and if dynamically switchable is checked.

If so, change the value to TRUE.

I just checked ides, it does allow for this.

To keep that scripting setting permanent, put it in as a profile parameter in rz10.

After that you have to tell the sid you it will allow user scripting.
Go to gui options and select accessibility & scripting and check "enable scripting" (and select or unselect the sub checkboxes as needed).

You will also need to be running the saplogon pad when you run your script.
With all this, you should be able get to a logon screen.

The code you list appears to be trying to hook to a productive system and call a z tcode.
In order for that to work you will need to make sure that either basis or security allow or can set the profile parameter for you (there is one to allow just for specific users). You will also need to be granted the proper authorizations for the user performing the script.
Also large amounts of data going over the gui may time out, consume workprocesses, check with abap to see if they can help you out with better methods for data extractions.

And of course, there is a jco connector and a .net connector which you can use to access sap abap as well.

Sorry, I know this message was from last month,
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.