Excel Macro调用SAP Module

Public ERP                     As Object
Public connect               As Object
Public sapModule          As Object
Public renturn               As Object
Public tab                     As Object

 

Public Function Logon() As Boolean
 If connect Is Nothing Then
      
        Set ERP = CreateObject("SAP.Functions")
        Set connect = ERP.Connection
      
        connect.system =   "システムID
        connect.Applicationserver =  "サーバ
        connect.Client =   "クライアント
        connect.Language =   "言語
        connect.user =    "ユーザID
        connect.Password =   "PASSWORD
        connect.codepage =   "codepage
 
        If connect.Logon(0, True) <> True Then 
            Set connect = Nothing
            Logon = False
            Exit Function
       End If
    Else
      If connect.reconnect <> True Then
         If connect.Logon(0, True) <> True Then 
            Set connect = Nothing
            Logon = False
            Exit Function
         End If
      End If
    End If

    Logon = True

End Function

Sub callSapModule()
    Set sapModule = Nothing
    "汎用モジュール呼出
    Set sapModule = ERP.Add("Z_XXXXX")
    sapModule.exports("I_XXXXX") =
   
    sapModule.Call
      
    Set return = sapModule.imports("E_XXXXX")
    Set tab = sapModule.TABLES("T_XXXXX")
  
End Function

你可能感兴趣的:(Excel Macro调用SAP Module)