VBA Excel SSO到SAP/Runtime Error 70&Quot;访问被拒绝&Quot; [英] VBA Excel SSO to SAP / runtime error 70 "access denied"

查看:22
本文介绍了VBA Excel SSO到SAP/Runtime Error 70&Quot;访问被拒绝&Quot;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我花了几个小时找出问题所在。 我想用ini文件启动SAP Logonpad,它可以很好地工作。 然后,在绑定到脚本对象之后,我希望使用connection=SapGui.OpenConnection("SID",True)打开到特定系统的连接 但始终收到运行时错误70访问被拒绝。

我跟随别人对VB的做法,由于某些原因,我不能用VB做,而必须用VBA做,所以可能有一些差异导致它失败?

我们非常感谢您的任何建议。

    Private Sub CommandButton1_Click()


    Dim SapGui As Object

    Dim saplogon As Object

    Dim connection 'As Object



    Set SapGui = GetObject("SAPGUI")


    Dim Wshshell As Object


    Set Wshshell = CreateObject("Wscript.Shell")

    Wshshell.Run Chr(34) & ("C:Program FilesSAPPCFrontEndSAPgui
    saplogon.exe") & Chr(34) & " " & "/INI_FILE" & "=" & Chr(34) & 
    "\longpathtoiniapplSapsaplogonintsaplogon.ini" & Chr(34)

        Do Until Wshshell.AppActivate("SAP Logon")
            Application.Wait Now + TimeValue("0:00:01")
        Loop

    Set Wshell = Nothing


    Set saplogon = SapGui.GetScriptingEngine

    connection = SapGui.OpenConnection("SID", True)


    Set SapGui = Nothing

    Set saplogon = Nothing

    Set connection = Nothing


    End Sub

推荐答案

检查特定系统是否允许用户脚本(事务RZ11,参数sapgui/user_scripting)。还要注意,对于某些版本,您显然需要指定SAP登录条目文本,而不是SID。

这篇关于VBA Excel SSO到SAP/Runtime Error 70&Quot;访问被拒绝&Quot;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆