on 04-22-2006 5:48 AM
hi all,
When I tried sending an Idoc from SAP to my .NET programming using the .NEt connector, the Idocs were passed to the port and returned the status code 03. But The BeginReceive event wasn't triggered. When I checked the TRFC queue using transaction BD87 I found the error "TARGET_METHOD_EXCEPTION raised by external server". May i know the reason for this error? I have configured RFC destination and the partner profile correctly.
Thanks in advance
Aananda
Hi Ananda,
Could your please help me out in how to configure SAP for the sending an IDOC like MATMAS from SAP to .NET.
Since i am new to SAP i dont know to configure the RFC Destination especially the Program ID. It would be much helpful if you could help me in this regard
Thanks & Regards
Prakash K
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Ananda,
Can you provide some code how you accessed the IDOCs from .Net
Regards
ram
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
class IdocReceive : SAP.Connector.SAPIDocReceiver
{
protected SAPLogonDestination Destination;
public IdocReceive(string args, SAPServerHost host) : base(args,host)
{
this.Destination = new SAPLogonDestination();
this.Destination.Client = 800;
this.Destination.DestinationName = "SAP";
this.Destination.Language = "english";
this.Destination.Password = "ruban";
this.Destination.Username = "ruban";
this.BeginReceive += new SAP.Connector.SAPIDocReceiver.ReceiveEventHandler(this.idoc_BeginReceive);
this.EndReceive += new SAP.Connector.SAPIDocReceiver.ReceiveEventHandler(this.idoc_EndReceive);
}
static private SAPServerHost idochost = new SAPServerHost();
private System.IO.StringWriter sw;
private System.Text.StringBuilder sb;
protected override int CheckTransaction(RfcTID tid)
{
Console.WriteLine("Checking TID " + tid.ToString());
return 0;
}
protected override int CommitTransaction(RfcTID tid)
{
Console.WriteLine("Committing TID");
return 0;
}
protected override void RollbackTransaction(RfcTID tid)
{
Console.WriteLine("Rolling back TID");
}
protected override int ConfirmTransaction(RfcTID tid)
{
Console.WriteLine("Confirming TID\n");
return 0;
}
static void Main(string[] args)
{
int noOfServers = 3;
IdocReceive idocsrv = null;
for (int i=0;i < noOfServers; i++)
{
idocsrv = new IdocReceive("-aIdocReceive -xsapgw00 -gsap", idochost);
Console.WriteLine("Created idoc server {0}", i + 1);
}
// output parameters used to create idoc servers
Console.WriteLine("\nprogram id is: " + idocsrv.ProgramID +
"\ngateway host is: " + idocsrv.SAPGatewayHost +
"\ngwservice is: " + idocsrv.SAPGatewayService);
// start all of the idoc receivers in the host
Console.WriteLine("\n . . . starting all idoc servers in Idoc Server host . . .");
idochost.Start();
Console.WriteLine("\ntype 'Exit' to quit\n");
string command = "";
do
{
command = Console.ReadLine();
}
while (command.ToUpper() != "EXIT");
Console.WriteLine("Exiting application");
}
private void idoc_BeginReceive(object sender, SAP.Connector.SAPIDocReceiver.ReceiveEventArgs e)
{
// this method is called when an idoc is received.
// we tell the idoc receiver to write to a stream writer
Console.WriteLine( "\nidoc begin receive event was raised");
// write to string builder
sb = new System.Text.StringBuilder();
sw = new System.IO.StringWriter(sb);
// Send the results to string writer
e.WriteTo = sw;
}
private void idoc_EndReceive(object sender, SAP.Connector.SAPIDocReceiver.ReceiveEventArgs e)
{
string idoc = sb.ToString();
Console.WriteLine("\nidoc end receive event was raised");
Console.WriteLine("\n -
< Idoc {0} > -
", idoc);
Console.WriteLine ("\n" + sw.ToString());
Console.WriteLine("\n -
");
sw.Close();
}
}
User | Count |
---|---|
83 | |
10 | |
10 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.