VB.NET 连接 SAP RFC(SAP Connection 3.0)
来源:互联网 发布:淘宝企业店铺出售转让 编辑:程序博客网 时间:2024/05/14 13:03
SAP 3.0 定义:
引用:SAP.Middleware.Connector
引用文件:sapnco,sapnco_utils
Public Destination As RfcDestination 'SAP Connector3.0 的RFC源
Public SapFunction As IRfcFunction 'SAP RFC函数调用
Public table As IRfcTable '调用到的RFC SAP table
SAP 3.0 配置连接类:(也可以放在APP.Config里面)
Public Class MyConfig
Implements IDestinationConfiguration '继承接口
Public Function ChangeEventsSupported() As Boolean Implements SAP.Middleware.Connector.IDestinationConfiguration.ChangeEventsSupported
Return False
End Function
Public Event ConfigurationChanged(destinationName As String, args As SAP.Middleware.Connector.RfcConfigurationEventArgs) Implements SAP.Middleware.Connector.IDestinationConfiguration.ConfigurationChanged '事件
Public Function GetParameters(destinationName As String) As SAP.Middleware.Connector.RfcConfigParameters Implements SAP.Middleware.Connector.IDestinationConfiguration.GetParameters
Dim parms As RfcConfigParameters = New RfcConfigParameters()
If ("dev_000".Equals(destinationName)) Then
parms.Add(RfcConfigParameters.AppServerHost, "11,11,11,11") 'SAP主机IP
parms.Add(RfcConfigParameters.SystemNumber, "00") 'SAP实例
parms.Add(RfcConfigParameters.User, "user") ' 用户名
parms.Add(RfcConfigParameters.Password, "123") '密码
parms.Add(RfcConfigParameters.Client, "300") ' Client
parms.Add(RfcConfigParameters.Language, "EN") '登陆语言
parms.Add(RfcConfigParameters.PoolSize, "5")
parms.Add(RfcConfigParameters.MaxPoolSize, "10")
' parms.Add(RfcConfigParameters.IdleTimeout, "60")
parms.Add(RfcConfigParameters.Codepage, "8400") ‘中文编码
Return parms
ElseIf ("prd_000".Equals(destinationName)) Then
parms.Add(RfcConfigParameters.AppServerHost, "11,11,11,11") 'SAP主机IP
parms.Add(RfcConfigParameters.SystemNumber, "00") 'SAP实例
parms.Add(RfcConfigParameters.User, "user") ' 用户名
parms.Add(RfcConfigParameters.Password, "123") '密码
parms.Add(RfcConfigParameters.Client, "800") ' Client
parms.Add(RfcConfigParameters.Language, "EN") '登陆语言
parms.Add(RfcConfigParameters.PoolSize, "5")
parms.Add(RfcConfigParameters.MaxPoolSize, "10")
' parms.Add(RfcConfigParameters.IdleTimeout, "60")
parms.Add(RfcConfigParameters.Codepage, "8400") ‘中文编码
Return parms
Else
Return Nothing
End If
End Function
End Class
SAP3.0 连接SAP
Public Sub ConnectSAP()
Dim ID As IDestinationConfiguration = New MyConfig() '继承
RfcDestinationManager.RegisterDestinationConfiguration(ID)
Try
If GetSapValue = "DEV" Then
Destination = RfcDestinationManager.GetDestination("dev_000") '连接SAP, SAPConnector 3.0方式 DEV SYSTEM
ElseIf GetSapValue = "PRD" Then
Destination = RfcDestinationManager.GetDestination("prd_000") '连接SAP, SAPConnector 3.0方式 PRD SYSTEM
End If
Catch ex As Exception
MyMsgBox("提示", ex.Message.ToString)
Exit Sub
End Try
End Sub
SAP 3.0 使用:
Try
SapFunction = Destination.Repository.CreateFunction("YRFC001") '建立一个函数对象
SapFunction.SetValue("P_MATNR", txtMaterialNo.Text) '传递参数
SapFunction.SetValue("P_WERKS", "1000")
SapFunction.Invoke(Destination) '激活提交
GetTable = SapFunction.GetTable("YTABLE") '返回表 The backend has added one more line to it.
Catch ex As Exception
MyMsgBox("提示", ex.Message.ToString)
Exit Sub
End Try
SAP 3.0客户端运行库:
NCo303_Net40_x86 FOR.NET 4.0
相关文档:NCo_30_ProgrammingGuide
- VB.NET 连接 SAP RFC(SAP Connection 3.0)
- VB.NET通过SAP.Connector调用SAP的RFC
- SAP如何通过RFC连接.NET
- SAP如何通过RFC连接.NET
- asp.net c#语言RFC连接SAP
- SAP RFC 连接 SAP端RFC设置
- .NET用NCO连接SAP RFC---写数据到SAP
- VB.net连接SAP实例
- VB.net连接SAP实例
- .NET连接SAP系统专题:SAP中新建可远程调用的RFC(二)
- VB调用SAP的RFC
- 旧的 VB.NET 的 SAP RFC登陆方式
- VB.NET中SAP RFC调用接口封装
- JAVA 与SAP RFC连接
- .NET连接SAP系统专题:.NET调用RFC几种方式(一)
- VS.NET调用SAP RFC
- asp.net 链接SAP.RFC
- .NET用NCO连接SAP 从RFC查询数据 代码配置连接SAP的信息
- 缓存类
- tiny 210 编译出错解决/init: line 103: can't open /r/dev/console: no such file
- 华为南研2011年“Openday”
- android GPS定位系统
- ssh配置文件
- VB.NET 连接 SAP RFC(SAP Connection 3.0)
- 第十二周实验指导--任务三--设计一个在下面一段类的定义中,自行车类的虚基类为车辆类,机动车类的虚基类也为车辆类,摩托车类的基类为自行车类和机动车类,类之间均为公有继承
- mips中的read、write、ioremap、out、in函数
- 关于Oracle 10g ORA-12514的解决方案
- 一个游戏程序员的学习资料
- 【通信系统设计】呼叫设计模式简述
- c语言入门
- OP AMP - 单电源对运算放大器的影响
- Oracle DDL,DML,DCL,TCL 基础概念