简体   繁体   English

为什么我不能创建静默 SAP RFC 连接

[英]Why can't I create a silent SAP RFC connection

I would like to create a silent SAP.FUNCTIONS connection to SAP using Excel VBA. Whenever I set the password, the connection object gets trashed.我想使用 Excel VBA 创建到 SAP 的静默 SAP.FUNCTIONS 连接。每当我设置密码时,连接 object 都会被破坏。 Is this even possible?这可能吗?

Sub Connect_to_SAP()

    Dim myConnection As Object
    Set myConnection = CreateObject("SAP.Functions.unicode")
    
    With myConnection
      .Connection.System = "SID" 'Systemname
      .Connection.client = "800" 'Client
      .Connection.APPLICATIONSERVER = "192.111.222.333"
      .Connection.user = "MYUSERNAME" 'User
      .Connection.Password = "MYPASSWORD" ' <=== after that, myConnection.connection object is trashed
      .Connection.Language = "EN" 'Language
      .Connection.systemnumber = "00" 'Systemnumber
    End With
    
    'Establish connection.
    If myConnection.Connection.logon(0, True) <> True Then Exit Sub
    'System Logoff
    myConnection.Connection.LOGOFF

End Sub

NB: This is under SAPGUI 7.6 pl4.注意:这是在 SAPGUI 7.6 pl4 下。 We are connecting to SAP with 7.60 pl6 using the MYSAPSSO ticket (portal SSO).我们使用 MYSAPSSO 票证(门户 SSO)连接到 7.60 pl6 的 SAP。

In order to test that a silent connection is working under 7.60 pl4, here were my steps.为了测试静默连接是否在 7.60 pl4 下工作,我的步骤如下。

  1. Use the standard SAP login dialog (aka loud) and make a connection.使用标准的 SAP 登录对话框(又名大声)并建立连接。 .Logon(0, False) .登录(0,假)
  2. Create a new connection object and set it = to the open connection.新建一个连接object,设置=为打开的连接。
  3. Log out of the first (loud connection) and set it to nothing.注销第一个(响亮的连接)并将其设置为空。
  4. With the new connection filled in (including the encrypted password from the loud login) I can then just exec.Logon(0, True) to test a silent logon.填写新连接(包括大声登录的加密密码)后,我就可以 exec.Logon(0, True) 来测试静默登录。

This works fine.这很好用。 It still doesn't give me any way to convert a user's password string to an SAP required encrypted password directly.它仍然没有给我任何方法将用户的密码字符串直接转换为 SAP 要求的加密密码。 Still, this does prove that a silent login does work under 7.50+ which was my original goal.尽管如此,这确实证明静默登录在 7.50+ 下确实有效,这是我最初的目标。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM