关于abap:SAP-ABAP-系统同微软-Office-套件进行-Desktop-Integration-的工作原理

7次阅读

共计 1618 个字符,预计需要花费 5 分钟才能阅读完成。

SAP 集成技术容许开发人员将与 OLE 兼容的桌面应用程序(例如 Microsoft Office、Lotus SmartSuite 或 Visio)集成到 SAP 零碎中。

通信和数据传输工作原理如下:

SAP GUI(Presentation 服务器)和 SAP 应用程序服务器之间的通信在 4.0 版中失去了扩大。这使得在 SAP GUI(管制框架)中蕴含 ActiveX 控件成为可能。

以 Office Excel 为例,在 Options -> Customize Ribbon 里将 Developer 标签配置进去:

Desktop Office 集成将此接口用于非凡控件(SAP Document Container Control 和 SAP Data Provider),它们是 SAP 零碎和 Desktop Office 应用程序之间的通信通道。

SAP Document Container Control 应用办法和属性与应用 OLE2 接口的桌面应用程序进行通信。

SAP Data Provider 是不同格局数据的容器和转换器。开发人员导入应用程序的数据将转换为基于 Internet 规范 MIME 的可读格局。SAP 数据提供者缓冲在 SAP 零碎中治理的文档数据。它还缓冲 SAP 数据,这些数据能够应用 R/3 链接插入到文档中。

而后在 Developer 标签页里就能够插入 ActiveX 控件了,比方 button:

这些按钮下面能够编写简略的 VBScript:

Private Sub CommandButton1_Click()
Set R3 = CreateObject("SAP.Functions")
    Set myConnction = R3.Connection
    myConnction.ApplicationServer = "ag3"
    myConnction.SystemNumber = 54
    myConnction.Client = "001"
    myConnction.user = "WANGJER"
    myConnction.Password = "your password"
    
    If myConnction.Logon(0, True) <> True Then
      MsgBox "Logon failed"
      Exit Sub
    End If
    
    Dim callFunctionModule As Object
        
    Set callFunctionModule = R3.Add("TH_USER_LIST")
    callFunctionModule.Call

    If callFunctionModule.Exception <> "" Then
        MsgBox callFunctionModule.Exception
    End If

    If callFunctionModule.Call = True Then
        Dim result As Object
        Set result = callFunctionModule.tables("USRLIST")
        Dim aSheet As Worksheet
        Dim sheetCol As New Collection
        sheetCol.Add ActiveWorkbook.Sheets(1)
        For Each aSheet In sheetCol
            Dim i As Integer
            i = 1
            For Each user In result.Rows
                
                Client = user(2)
                UserName = user(3)
                Terminal = user(5)
                IP = user(16)
                aSheet.Cells(i, 1) = Client
                aSheet.Cells(i, 2) = UserName
                aSheet.Cells(i, 3) = Terminal
                aSheet.Cells(i, 4) = IP
                
                i = i + 1
            Next
        Next
    Else
        MsgBox "Call Failed! error:"
    End If
'log off
    myConnction.logoff
End Sub

这两个控件都有一个到 SAP 零碎的接口。SAP Data Provider 的接口是应用功能模块实现的。桌面办公室集成的 ABAP 类和接口提供了到 SAP 文档容器控件的接口。

正文完
 0