on 08-12-2009 9:00 AM
Hi Experts..
We are getting the following error while connecting from Dot net to SAP using Dot net connector
An unhandled exception of type 'SAP.Connector.RfcException' occurred in sap.connector.dll
Additional information: Open file 'C:\WINDOWS\sapmsg.ini' failed
We cannot find the above file "sapmsg.ini'" in the windows location.
Please find the below code for Dot net connector:
using System;
using SAP.Connector;
using SAP.Connector.Rfc;
using System.Data;
using System.IO;
using System.Collections;
namespace EprConn
{
public class Class1
{
public Class1()
{
}
public string str()
{
SAP.Connector.Destination dest= new SAP.Connector.Destination();
RfcTID id=SAP.Connector.RfcTID.NewTID();
dest.Username = "aaaa"; //SAP UserName
dest.Password = "bbbb"; //SAP Password
dest.AppServerHost = "ip adress"; // Application Server IP
dest.Client = 120; //Client ID
dest.SystemNumber= Int16.Parse("00"); // System ID
dest.Language ="en";
dest.SAPSystemName="ECD";
SAPConnection connection1 = new SAPConnection(dest);
SAPProxy1 RFCSap = new SAPProxy1();
connection1.Open(); // Getting error on this line
object [] obj1 =new object[3];
obj1[0]="0002000000";
obj1[1]="DT01";
try
{
RFCSap.tRfcInvoke("BAPI_VENDOR_GETDETAIL",obj1,id);
}
catch(Exception ex)
{
string s= ex.Message.ToString();
}
return str();
}
}
}
}
Quick Response is appreciated!!!!
Hi Mohammed,
u2022 I notice that you do not associate the SAPProxy with the created SAPConnection; so they are independent runtime entities. You need to associate the proxy with a connection:
SAPConnection connection1 = new SAPConnection(dest);
SAPProxy1 RFCSap = new SAPProxy1();
RFCSap.Connection = connection1; <=======
connection1.Open(); // Getting error on this line
u2022 You might want to consult Ken Koos; he posted a similar question with a u2018SAP.Connector.RfcExceptionu2018 , and later on told us he figured out the [cause|;
u2022 Also, check out: http://sap.ittoolbox.com/groups/technical-functional/sap-dev/problem-with-sapnet-connector-sapmsgini...; is any of it comparable to how you made your connection ?
u2022 BTW: do you have the SAP RFC SDK installed on the machine from which you run your code ?
Hopes this helps you on your way;
However, I do want to question your usage of the NCo; since this is a discontinued SAP technology (see [Future support of NCo|] )
There are other means to integrate SAP and .NET: via SAP BAPI web services, or via the BizTalk SAP Adapter. The latter has conceptual a big resemblance with the NCo approach, but is instead a Microsoft technology. Coincidentally I posted yesterday a blog-entry on my [successful application of the SAP Adapter|http://williamvanstrien.blogspot.com/2009/08/apply-wcf-biztalk-adapter-pack-to.html ]
Best regards, William.
Edited by: WvStrien on Aug 12, 2009 12:16 PM
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
88 | |
23 | |
11 | |
9 | |
8 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.