跪求C#连接SAP解决方案

futurewind 2007-08-15 06:03:10
做一个c#.net调用SAP RFC函数的方法,现在连接测试可以通过,但是在调用方法时候
程序就一直跑,不动了,也不报错。请大侠们帮忙看一下,万分紧急啊!!!!救命!
RFC函数在SAP中运行时间已经测试,只需要不到1妙就可以获取数据了。
源程序如下:

SAPLogonCtrl.SAPLogonControlClass SapLogon = new SAPLogonCtrl.SAPLogonControlClass();
SapLogon.Client = "300";
SapLogon.Language = "ZH";
SapLogon.User = "osap";//R3登陆用户名
SapLogon.Password = "123456";//登陆密码
SapLogon.ApplicationServer = "10.1.2.11";//r3服务器
SapLogon.SystemNumber = 0;
//以下建立与R3的通信机制
SAPLogonCtrl.Connection sapLogon = (SAPLogonCtrl.Connection)SapLogon.NewConnection();//建立连接
bool logon = sapLogon.Logon(0,true);
if (logon)
{
Response.Write("Yes");
}
else
{
Response.Write("No");
return;
}

SAPFunctionsOCX.SAPFunctionsClass sapfc = new SAPFunctionsOCX.SAPFunctionsClass();

sapfc.Add("Z_RFC_SD_PLANT"); //此句就不动了
...全文
1183 11 打赏 收藏 转发到动态 举报
写回复
用AI写文章
11 条回复
切换为时间正序
请发表友善的回复…
发表回复
oceanshade 2008-10-19
  • 打赏
  • 举报
回复
非常感谢!!!
有了VB.Net的一样可以!
somay 2008-07-28
  • 打赏
  • 举报
回复
我们都是用VB.net写,编译后在C#下调用
Imports SAPBAPIControlLib
Imports SAPTableFactoryCtrl
Imports System.Xml

Public Class Class1
Public bapi As Object = CreateObject("SAP.Functions")
Public Function GetConn() As Object
Dim connection As Object
connection = bapi.Connection
connection.ApplicationServer = My.Settings.Server
connection.Client = My.Settings.Client
connection.Language = My.Settings.Language
connection.User = My.Settings.User
connection.Password = My.Settings.Password
connection.SystemNumber = My.Settings.SystemNumber
connection.CodePage = My.Settings.CodePage
Return connection
End Function

'费用科目列表
Public Function GetSubjectList(ByVal comanyCode As String) As String
Dim connection As Object
Dim returnString As String
returnString = "<SubjectList>"
connection = GetConn()
If (connection.Logon(0, True)) Then

Dim codes = bapi.Add("Z_OA_001")
codes.Exports.Item("BUKRS") = comanyCode
codes.call()
Dim table As Table
table = codes.Tables("ACCOUNTS")

Dim I As Integer

For I = 1 To table.RowCount
returnString = returnString + "<item>"
returnString = returnString + "<id>" + table.Cell(I, "SAKNR") + "</id>"
returnString = returnString + "<txt>" + table.Cell(I, "TXT50") + "</txt>"
returnString = returnString + "</item>"
Next
End If
returnString = returnString + "</SubjectList>"
connection.logoff()
Return returnString
End Function
futurewind 2007-08-17
  • 打赏
  • 举报
回复
我就不信没人会了
futurewind 2007-08-17
  • 打赏
  • 举报
回复
继续顶,继续求救!!!!!
futurewind 2007-08-17
  • 打赏
  • 举报
回复
下班前再顶一下,高手进来帮帮忙吧!
xczgb 2007-08-16
  • 打赏
  • 举报
回复
搂主还在不。我也要调用SAP RFC 。我现在是还找不到头绪。问你几个问题啊。
futurewind 2007-08-16
  • 打赏
  • 举报
回复
关键不是我不想开放,我不是BASIS,没有这个权限,那个RFC方法别人JAVA程序调用是没有问题,现在我用C#去调用,因为之前没有经验,如果各位有源代码可以提供参考一下!多谢了!大侠救命啊!!!!!
JustLovePro 2007-08-16
  • 打赏
  • 举报
回复
我也撞见过这类问题,最后的解决方案是用vb实现,而后在c#中调用vb的exe文件~~~~

谁有更好的办法???
futurewind 2007-08-16
  • 打赏
  • 举报
回复
怎么就没人给个例子呢,晕,呼唤高手降临!!!!!救命啊!
mrshelly 2007-08-16
  • 打赏
  • 举报
回复
SAP 服务,毕竟不是人人都能玩得起的.....
你可以把服务开放出来,大家来测.当然问题也容易解决了...
futurewind 2007-08-16
  • 打赏
  • 举报
回复
晕,哪位高手说句话!!!!!!!!!

110,561

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧