cancel
Showing results for 
Search instead for 
Did you mean: 

idocsender

Former Member
0 Kudos

i am trying to send an idoc(see below) with idocsender in an asp.net application

ABC.txt is where the idoc is

i make the connection to my sap okay

string dataFile = "ABC.txt" ;

string txtIdocContents;

string filePath = (Server.MapPath(dataFile));

StreamReader str = File.OpenText(filePath);

txtIdocContents = str.ReadToEnd();

TextReader t = str;

RfcTID myTid = RfcTID.NewTID();

try

{

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

sapiDocSender2.SubmitIDoc(t,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 get the following error

txtProblem submitting IDOC to SAP System.ArgumentException: iDoc Parameter name: Invalid IDoc. at SAP.Connector.SAPIDocSender.ParseIDocStream(TextReader iDoc) at SAP.Connector.SAPIDocSender.SubmitIDoc(TextReader iDoc, RfcTID tid) at sap6.WebForm1.Button1_Click(Object sender, EventArgs e) in
psbeh18\wwwroot$\sap6\default.aspx.cs:line 137

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

please help

very new to this

any ideas or direction to help info would be greatly appreciated

Accepted Solutions (1)

Accepted Solutions (1)

0 Kudos

Please use the other overload, i.e.

SubmitIDoc(string iDocPath, RfcTID tid);

This means, instead of

 sapiDocSender2.SubmitIDoc(t,myTid)

, try using

sapiDocSender2.SubmitIDoc(filePath,myTid);

2. Make sure the file has correct permissions.

3. Good luck with RFC/IDocs!!

Former Member
0 Kudos

thank you thank you for the help

i am now getting a different error

any ideas?

I now use

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

and I get the following error

txtProblem submitting 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) at sap6.WebForm1.Button1_Click(Object sender, EventArgs e) in
psbeh18\wwwroot$\sap6\default.aspx.cs:line 137

0 Kudos

1. Congratulation on you successful resolution of first problem -- please indicate it in "Reward Points".

2. Now that your IDoc is attempting to enter into SAP database, integrity checks are being carried out and the IDoc contents are not being accepted.

You may be having problem with acceptance of you control record EDI_DC40. Things mentioned in it must be valid on your SAP database.

Using the "Inbound IDoc Processing -- WE16" from SAP GUI, first manually import it into SAP to confirm if it is not corrupted. Make sure you have the trading partner/port referred in this IDoc properly setup. Do all the trouble shooting of IDoc contents using SAP GUI before attempting its import via connector.

Former Member
0 Kudos

thank you thank you thank you again

i have my idoc in a file c:
ABC.txt. this idoc is from an example i am using.

I created a port called INTERNAL.

when i try to run WE16 putting in c:
ABC.txt and port INTERNAL is says

error opening file 'c:
ABC.txt'.

Is this because it cannot find the file. Does it need to be in a special directory or something?

any ideas would be greatly appreciated

0 Kudos

SAP cannot access you C: drive. Create a share at SAP server. If your SAP server's name is SAPSERVER, and you share its C: drive as CDRIVE, the UNC name of that share would be


SAPSERVER\CDRIVE

copy ABC.txt into
SAPSERVER\CDRIVE and define it in the port definition of "INTERNAL".

Now try WE16. It should work

Former Member
0 Kudos

since i am a very beginner can you please explain how to do this step by step

thank you so much for being so helpful and patient

Answers (0)