在C#中查找SAP .NET Connector的示例 [英] Looking for sample of SAP .NET Connector in C#

查看:74
本文介绍了在C#中查找SAP .NET Connector的示例的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一个C#示例,其中在VS .net 2003中创建了SAP Connector Proxy,以便在VS 2005 .net中使用。非常感谢任何建议,指示。

I am looking for a C# sample where an SAP Connector Proxy was created in VS .net 2003 to be used in VS 2005 .net. Thanks much for any advises, directions.

推荐答案

可以从VS 2005引用VS 2003程序集,并在.NET 2.0上正常运行。我现在正在这样做,并没有任何问题。我有一些名称共谋的问题,所以为了避免这种情况,我最终为每个bapi创建了一个代理,并将每个代理放在一个单独的命名空间中。我最初也尝试使用IO Struct选项,虽然它生成的代码没有问题但似乎没有用,所以我不使用它。我的VS 2003项目只包含代理,其余的我来自VS 2005.
然而,每个bapi都有一些使用单独代理的问题:我发现你不能同时为多个代理共享同一个连接实例此外,SAP将CommitWork方法放在代理上。这使得在同一事务范围内执行多个命令比应该更困难。我通过维护一个待提交的代理列表来解决这个问题;一旦所有调用完成,我遍历每个代理并调用commitwork。这已经足够满足我的需求但是我发现BAPI_ALM_ORDER_MAINTAIN将锁定维护顺序,直到调用commitwork或处理代理,因此如果您需要在相同的事务范围内再次修改订单或使用另一个bapi我假设您需要使用相同的代理实例,如果延迟提交,直到稍后您需要确保在事务未提交或订单将保持锁定的情况下正确处理代理。

The VS 2003 assembly can be referenced from VS 2005 and runs fine on .NET 2.0.  I am doing this now and haven't had any issues.  I have had a few issues with name collusions so to avoid this I ended up creating one proxy for each bapi and placed each proxy in a seperate namespace.  I also initially tried to use the IO Struct option, although it generates the code without issue it doens't seem to work, so I don't use it.  My VS 2003 project contains only the proxies, the rest I do from VS 2005. 
There is however a couple issues using seperate proxies for each bapi: I found that you cannot share the same connection instance for multiple proxies at the same time, additionally, SAP placed the CommitWork method on the proxy.  This makesit more difficult than it should be to execute multiple commands within the same transactional scope.  I've worked around this by maintaining a list of proxies pending commit; once all calls have been completed, I loop through each proxy and call commitwork.  This has worked well enough for my needs however I have found that BAPI_ALM_ORDER_MAINTAIN will lock the maitenance order until commitwork is called or proxy is disposed, so if you need to modify the order again with in the same transactional scope or using another bapi I assume you need to use the same proxy instance, also if you delay commit until later you need to ensure proxies are properly disposed in the event the transaction does not commit or the order will remain locked. 

HTH


这篇关于在C#中查找SAP .NET Connector的示例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆