cancel
Showing results for 
Search instead for 
Did you mean: 

idoc to sap using sap.net connector

Former Member
0 Kudos

i get the following error

IDOC to SAP SAP.Connector.RfcException: Invalid connection. at SAP.Connector.SAPClient.tRfcInvoke(String method, Object[] methodParamsIn, RfcTID tid) at SAP.Connector.SAPIDocSender.TRfcIDocInBoundAsynchronous(EDI_DC40_BLOCKList iDocControlRec40, EDI_DD40_BLOCKList iDocDataRec40, RfcTID tid) at SAP.Connector.SAPIDocSender.SubmitIDoc(TextReader iDoc, RfcTID tid) at SAP.Connector.SAPIDocSender.SubmitIDoc(String iDocPath, RfcTID tid)

i use the following idoc

EDI_DC40 0000000000000037249620 3012 EXCHANGE_RATE01 EXCHANGE_RATE EXCHANRBFILEPORTLS BTS2000 EXCHANSAPMBS LS BTS2000 20021014113506

E2EXCHANGE_RATE000 000000000000003724900000100000001 X

E2BP1093_0001 000000000000003724900000200000102M AED JPY 200210101.02 1 1 1.02 1 1

i use the following code

proxy.Connection = SAP.Connector.SAPLoginProvider.GetSAPConnection(this);

//sapiDocSender1.Connection = new SAP.Connector.SAPConnection(this.destination1);

sapiDocSender2.SubmitIDoc((Server.MapPath(dataFile)),myTid);

proxy.ConfirmTID(myTid);

HttpContext.Current.Response.Write ("Idoc was submitted to SAPlook at transaction WE02 in SAP");

}

catch (Exception ex)

{

HttpContext.Current.Response.Write ("Problem submitting IDOC to SAP\n" + ex.ToString());

}

i have the idoc file in d:\idocs\abc.txt and i can access it using transaction WE16 the port is INTERNAL

Do I need to change the idoc or do i need to create a parter. if so how do i do that?

any help would be great

thanks in advance

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

please disregard the previous post

i got this to work

thank you SOOOO MUCHHHH

reiner_hille-doering
Active Contributor
0 Kudos

The problem doesn't sound like one with the IDOC, but seems to be related to the RFC connection

proxy.Connection = SAP.Connector.SAPLoginProvider.GetSAPConnection(this);

This only works if you have a Login page in the application that sucessfully does the authentication and stores the connection information in Session state.

sapiDocSender1.Connection = new SAP.Connector.SAPConnection(this.destination1);

This should work, but of cause you need to have a correctly initialized destination1 in your form.

proxy.ConfirmTID(myTid);

This is correct, but note that you need to reinitialize myTid on each subsequent send, because ConfirmTID closes the transaction and marks myTid unusable.

Former Member
0 Kudos

i do have a login page that works correctly

{

// Bind data back

this.destination1.Username = this.user.Text;

this.destination1.Password = this.password.Text;

try

{

this.destination1.Client = short.Parse(this.client.Text);

}

catch(Exception)

{

so i see records in the datagrid but when i do the rfc call is when i get the above error

any other ideas of where i can look

this.destination1.Client = 0;

}

if (this.language.Text.Length > 0)

{

this.destination1.Language = this.language.Text;

}

try

{

SAP.Connector.SAPLoginProvider.OpenSAPConnection(this, destination1.ConnectionString, this.persist.Checked);

}

catch (System.Exception exception)

{

this.message.Text = exception.ToString();

}

the login seems to work fine because before the rfc call i do the following and i get records back from the table

try

{

proxy.Connection = SAP.Connector.SAPLoginProvider.GetSAPConnection(this);

// Call methods here

proxy.Rfc_Customer_Get("", txtCust.Text, ref brfcknA1Table2);

// Now update Data Bindings. On WinForms this will be automatic, on // WebForms call the following line

//num1 = this.brfcknA1Table1.Count;

HttpContext.Current.Response.Write ("here");

this.DataBind();

Former Member
0 Kudos

>

proxy.Connection =
> SAP.Connector.SAPLoginProvider.GetSAPConnection(this);
> 

> This only works if you have a Login page in the

> application that sucessfully does the authentication

> and stores the connection information in Session

> state.

>

Hi,

If I don't have login page, because I want to put a fixed username / password you know how can I do ?

Former Member
0 Kudos

It's ok, sorry first time on this forum.

I find my response here :