1、版本 3.0.25.0 for .NET v4.0 on x64/x86
2、发布时间:2022.07
3、对应SAP版本:7700
解决的问题:
现象:
如果SAP服务端是2022年最新的7700版本(实施商的说法,实际是否最新有待证实);通过NuGet或网上找的一下DLL库都太老了,在一切配置都正常的情况下调用repository.CreateFunction("接口名")时报错误:
SAP.Middleware.Connector.RfcCommunicationException:“destination XXXX failed when calling RFC_METADATA_GET -- see log for details”
猜测的原因:
老的DLL库在获取接口实例时,会触发“RFC_METADATA_GET”,7700版本的SAP可能没有了这个函数。
解决的办法:
升级sapnco的SDK。附件是2022.07发布的SDK,直接替换即可使用。亲测.net4.0-4.8的版本均可正常使用。
使用简介:
1、将DLL库引入到项目中,只需要:sapnco.dll 和 sapnco_utils.dll
2、Demo
RfcConfigParameters parms = new RfcConfigParameters
{
{ RfcConfigParameters.Name, "NCO-TEST" }, // 连接名称可以自定义
{ RfcConfigParameters.AppServerHost, "172.xx.x.32" }, //SAP主机IP
{ RfcConfigParameters.SystemNumber, "00" }, //SAP实例
{ RfcConfigParameters.User, "WSDEVxx0" }, //用户名
{ RfcConfigParameters.Password, "xxxx123456" }, //密码
{ RfcConfigParameters.Client, "110" }, // Client(集团名称)
//{ RfcConfigParameters.SystemID, "xx4" }, // 可选,连接上后自动可以识别
{ RfcConfigParameters.Language, "ZH" } //登陆语言
};
// 建立连接
RfcDestination sapRfcDestination = RfcDestinationManager.GetDestination(parms);
// 参数正确即可ping通,否则ping方法报错
SapRfcDestination.Ping();
// 获取Repository
RfcRepository sapRfcRepository = sapRfcDestination.Repository;
// 获取接口实例,如果是老DLL,在此报错:destination NCO-TEST failed when calling RFC_METADATA_GET
IRfcFunction func = sapRfcRepository.CreateFunction("ZANPPFM_XXXXX_CONF");
// 设置输入参数
……
// 执行接口实例
func.Invoke(sapRfcDestination);
// 获取输出参数
……
评论0