Skip to Content
author's profile photo Former Member
Former Member

Connection to SAP via VBA - Runtime Error 614

Hello community,

i am new to the forum and new to scripting with VBA and SAP.

I want to extract data from a table i get with a transaction in SAP automatically.

Before i start to extract the data, the connection must work and here is my Problem.

I always get the Runtime Error 614:

I activated scripting in the SAP Gui Configuration and in VBA:

Here is my program code to connect to SAP:

sub test()

If Not IsObject(SAP_Applic) Then Dim SapGuiAuto As Object On Error Resume Next Set SapGuiAuto = CreateObject("Sapgui.ScriptingCtrl.1") On Error GoTo 0 If SapGuiAuto Is Nothing Then MsgBox "Please start SAPlogon" Exit Sub End If On Error Resume Next Set SAP_Applic = SapGuiAuto.GetScriptingEngine On Error GoTo 0 If SAP_Applic Is Nothing Then MsgBox "Scripting disabled" Exit Sub End If End If If Not IsObject(Connection) Then Set Connection = SAP_Applic.OpenConnection("System", True) 'Enter your system here End If If Not IsObject(Session) Then Set Session = Connection.Children(0) 'this line is causing the error
End If If IsObject(WScript) Then WScript.ConnectObject Session, "on" WScript.ConnectObject SAP_Applic, "on" End If

end sub

I've searched in many discussions here in this forum and in other forums and customized my code, but it still does not work.

So i decided to register for this forum and ask you for help.

best regards

Steffen

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

1 Answer

  • Best Answer
    Posted on Sep 22, 2015 at 07:13 AM

    Hello Steffen,

    welcome in the Scripting Language forum.

    I try your code and in my case it works perfect. It seems not to be a problem of the code.

    Please check the following system parameters with RZ11:

    • sapgui/user_scripting should set to TRUE
    • sapgui/user_scripting_disable_recording should set to FALSE
    • sapgui/user_scripting_force_notification should set to FALSE
    • sapgui/user_scripting_per_user should set to FALSE
    • sapgui/user_scripting_set_readonly should set to FALSE

    Let us know your results.

    Cheers

    Stefan

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.