引用依赖:
VBA 调用 SAP API的RFC函数:RFC_READ_TABLE
Sub A()
'查询SAP表数据并输出到EXCEL,VBA中不区分大小写(保存后会自动把代码、变量转换大小写)Dim iData As Integer
Dim nField As Integer
Dim nData As Integer
Dim Result As Boolean
Dim vRow As Variant
MsgBox "程序开始"
'初始化登陆信息
Set SAP = CreateObject("SAP.functions.unicode") '使用SAP.FUNCTIONS时会出现中文字符从RFC传过来之后乱码的问题(变成#),使用SAP.FUNCTIONS.UNICODE就可以解决
SAP.Connection.System = "" '此处为系统标示
SAP.Connection.SystemNumber = "" '系统(实例)编号
SAP.Connection.client = "" '客户端
SAP.Connection.User = "" '用户名
SAP.Connection.Password = "" '密码
SAP.Connection.Language = "" '语言
SAP.Connection.ApplicationServer = "" '服务器地址
SAP.Connect