我在互联网上找到了很多例子,但很多都是旧的(VS 2003,SAP .Net Connector 2.0,其中当前为3.0).
我想知道如何使用SAP.NET连接器.
我应该安装哪些文件?
添加到项目的参考?
如何添加提供程序以在Server Explorer中创建连接?
我被要求使用SAP .NET Connector.我目前使用的是.NET 4.0和VS2010.有什么我需要降级的吗?
另外,有没有人知道在线有关如何使用它的任何当前教程?我所拥有的只是来自SAP的信息,这不是最直观的信息.
我将3个表传递给IRfcFunction,后者在SAP上创建订单.当我尝试调试此程序时,它没有给出任何错误消息,但这不是在SAP上创建任何订单.
我正在寻找解决此问题的任何帮助或提示.感谢您的时间.
IRfcFunction orderDetails = _rfcDest.Repository.CreateFunction(strBapi);
RfcStructureMetadata metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_PART");
IRfcStructure structPartners = metaData.CreateStructure();
structPartners.SetValue("PARTN_ROLE", "SP");
structPartners.SetValue("PARTN_NUMB", "110024");
IRfcTable tblPartner = orderDetails.GetTable("PARTNERS");
tblPartner.Append(structPartners);
structPartners = metaData.CreateStructure();
structPartners.SetValue("PARTN_ROLE", "SH");
structPartners.SetValue("PARTN_NUMB", "110005");
tblPartner.Append(structPartners);
orderDetails.SetValue("PARTNERS", tblPartner);
metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_COND");
IRfcStructure structConditions = metaData.CreateStructure();
structConditions.SetValue("ITM_NUMBER", "10");
structConditions.SetValue("COND_TYPE", "PR00");
structConditions.SetValue("COND_VALUE", "30");
structConditions.SetValue("CURRENCY", "USD");
IRfcTable tblConditions = orderDetails.GetTable("CONDITIONS");
tblConditions.Append(structConditions);
orderDetails.SetValue("CONDITIONS", tblConditions);
metaData = _rfcDest.Repository.GetStructureMetadata("ZBAPI_A_STRU_ORDER_CREATE_ITEM");
IRfcStructure structItems = metaData.CreateStructure();
structItems.SetValue("MATERIAL", "F500");
structItems.SetValue("TARGET_QTY", "3");
IRfcTable tblItems = orderDetails.GetTable("ITEMS");
tblItems.Append(structItems);
orderDetails.SetValue("ITEMS", tblItems);
RfcSessionManager.BeginContext(_rfcDest);
orderDetails.Invoke(_rfcDest);
IRfcStructure bapiTable = orderDetails.GetStructure("RETURN");
RfcSessionManager.EndContext(_rfcDest);
Run Code Online (Sandbox Code Playgroud) 我正在开发一个Windows应用程序,在这里我想从sap系统中提取数据并在datagridview中显示它...我已经提取了列名,如名称,城市等等.
我不知道如何从列中提取数据,任何人都可以帮我解决这些问题吗?
我正在使用RFC_READ_TABLE函数模块和rfc destiantion manager
提前致谢!!!
我想使用SAP创建和发送idoc到SAP.Net Connector 3.x.
我在我的应用程序中配置了一个RFC目标:
_rfcDestination = RfcDestinationManager.GetDestination(_destinationName);
Run Code Online (Sandbox Code Playgroud)
但我找不到任何关于如何创建和发送idocs的例子.
任何人都可以提供一些关于如何创建和发送idoc的示例代码吗?
在使用SAP .NET连接器的C#程序中,我想调用RFC函数“ BAPI_GET_PAYROLL_RESULT_LIST”并读取结果。
我用看了函数SE37。在那里,我发现导出参数应为BAPIRETURN1,这是一个结构。
因此,我搜索了RFC调用的示例代码,并针对我的情况对其进行了修改。
我已经尝试读取该表BAPI7004_RL,因为该表位于信息中,SE37并且我不知道是否必须使用export参数或该表。
这是我的代码:
string appServerHost = ConfigurationManager.AppSettings["AppServerHost"];
string name = ConfigurationManager.AppSettings["Name"];
string systemnumber = ConfigurationManager.AppSettings["SystemNumber"];
string user = ConfigurationManager.AppSettings["User"];
string pw = ConfigurationManager.AppSettings["Password"];
string client = ConfigurationManager.AppSettings["Client"];
string language = ConfigurationManager.AppSettings["Language"];
RfcConfigParameters parms = new RfcConfigParameters
{
{ RfcConfigParameters.AppServerHost, appServerHost },
{ RfcConfigParameters.Name, name },
{ RfcConfigParameters.SystemNumber, systemnumber },
{ RfcConfigParameters.User, user },
{ RfcConfigParameters.Password, pw },
{ RfcConfigParameters.Client, client },
{ RfcConfigParameters.Language, language }
};
RfcDestination dest …Run Code Online (Sandbox Code Playgroud) 我有一个函数,其中一个参数是一个表(T_ITEMS).
表的项目是类型/结构Z_ITEM,有两个字段:Value,Quantity;
如何在此表中添加Z_ITEM类型的项?
我所做的是遵循以下代码:
IRfcFunction fnct = repo.CreateFunction( "MY_FUNCTION" );
IRfcTable t_items = fnct.GetTable( "T_ITEMS" );
foreach( XmlNode oneNode in postdata.Items.SelectNodes( "//articles/article" ) ) {
IRfcStructure articol = repo.GetStructureMetadata("Z_ITEMS") as IRfcStructure;
articol.SetValue( "Value", oneNode.Attributes[ "value" ].Value );
articol.SetValue( "Quantity", oneNode.Attributes[ "quantity" ].Value );
t_items.Append( articol );
}
Run Code Online (Sandbox Code Playgroud)
在repo.GetStructureMetadata("Z_ITEMS")中我有结构但是当我转换为IRfcStructure变量时,articol为null.
当我尝试动态连接到SAP服务器时,我收到的错误就像
使用目标配置时不允许使用硬编码登录参数
任何一个PLZ帮助我
我需要从代码隐藏发送所有参数动态而不是从Web.config发送
从web.config它工作正常..但不是在这里
我的代码是这样的
SAPSystemConnect objSapConfig = new SAPSystemConnect();
RfcDestination objSapdestination = null;
RfcDestinationManager.RegisterDestinationConfiguration(objSapConfig);
RfcConfigParameters objParameter = new RfcConfigParameters();
objParameter.Add(RfcConfigParameters.AppServerHost, Convert.ToString("XXX"));
objParameter.Add(RfcConfigParameters.Client, Convert.ToString("XXX"));
objParameter.Add(RfcConfigParameters.Password, Convert.ToString("XXX"));
objParameter.Add(RfcConfigParameters.SystemNumber, Convert.ToString("XXX"));
objParameter.Add(RfcConfigParameters.User, Convert.ToString("XXX"));
objParameter.Add(RfcConfigParameters.Language, Convert.ToString("XXX"));
objParameter.Add(RfcConfigParameters.LogonGroup, Convert.ToString("XXX"));
objParameter.Add(RfcConfigParameters.PoolSize, Convert.ToString("XXX"));
objParameter.Add(RfcConfigParameters.PeakConnectionsLimit, Convert.ToString("5"));
objParameter.Add(RfcConfigParameters.IdleTimeout, Convert.ToString("XXX"));
//objParameter.Add(RfcConfigParameters.Name, Convert.ToString("XXX"));
objSapdestination = RfcDestinationManager.GetDestination(objParameter);
RfcCustomDestination customDest = objSapdestination.CreateCustomDestination();
IRfcFunction func = customDest.Repository.CreateFunction("XXX");
RfcRepository objSapRepository = objSapdestination.Repository;
// Calling Sap Function
IRfcFunction objSapDataFunction = objSapRepository.CreateFunction(Convert.ToString("XXX"));
objSapDataFunction.SetValue("XXX", "XXX");
objSapDataFunction.Invoke(objSapdestination);
// Filling SapData into Table
IRfcTable objSapTable = objSapDataFunction.GetTable(Convert.ToString("GIT_DATA"));
Run Code Online (Sandbox Code Playgroud)