on 05-24-2011 7:19 AM
Hi everybody,
I have just started testing the new Nco 3.0 connector with Visual Studio 2010 and I have found the first problem with it. I have read some articles about receiving IDOCs with some code snippets but I can't find information about submitting IDOCs from a .NET application to SAP.
Has anybody tested this functionality successfully? Please, could you tell how?
Best regards!!
Hi again, i have completed some tasks in the method to submit an IDOC from non-sap system to SAP but i still have a problem. How can i map the IDOC values in the code.
This is my code:
IdocControlRec40 = RFCIdoc_Inbound.GetTable("IDOC_CONTROL_REC_40");
structureIdocControlRec40 = IdocControlRec40.Metadata.LineType.CreateStructure();
structureIdocControlRec40.SetValue("TABNAM", "EDI_DC40");
structureIdocControlRec40.SetValue("MANDT", "300");
structureIdocControlRec40.SetValue("DOCNUM", "0000000000318807");
structureIdocControlRec40.SetValue("DOCREL", "700");
structureIdocControlRec40.SetValue("STATUS", "01");
structureIdocControlRec40.SetValue("DIRECT", "1");
structureIdocControlRec40.SetValue("OUTMOD", "2");
structureIdocControlRec40.SetValue("IDOCTYP", "ALEAUD01");
structureIdocControlRec40.SetValue("MESTYP", "ALEAUD");
structureIdocControlRec40.SetValue("STDMES", "ALEAUD");
structureIdocControlRec40.SetValue("SNDPOR", "COLORS_P");
structureIdocControlRec40.SetValue("SNDPRT", "LI");
structureIdocControlRec40.SetValue("SNDPRN", "ICC0167");
structureIdocControlRec40.SetValue("RCVPOR", "SAPPXC");
structureIdocControlRec40.SetValue("RCVPRT", "LS");
structureIdocControlRec40.SetValue("RCVPRN", "DLFSP0C100");
structureIdocControlRec40.SetValue("CREDAT", "20110316");
structureIdocControlRec40.SetValue("CRETIM", "144959");
structureIdocControlRec40.SetValue("ARCKEY", "4D8013A0702F040BE1008000889E09E4 0000000002263837");
IdocControlRec40.Insert(structureIdocControlRec40);
RFCIdoc_Inbound.SetValue("IDOC_CONTROL_REC_40", IdocControlRec40);
// Process the IDoc DDR40 data segment
IdocDataRec40 = RFCIdoc_Inbound.GetTable("IDOC_DATA_REC_40");
structureIdocDataRec40 = IdocDataRec40.Metadata.LineType.CreateStructure();
structureIdocDataRec40.SetValue("SEGNAM", "E1ADHDR");
structureIdocDataRec40.SetValue("MANDT", "");
structureIdocDataRec40.SetValue("DOCNUM", "");
structureIdocDataRec40.SetValue("SEGNUM", "1");
structureIdocDataRec40.SetValue("PSGNUM", "");
structureIdocDataRec40.SetValue("HLEVEL", "");
string prueba = "ALEAUD ALEAUD ";
structureIdocDataRec40.SetValue("SDATA", prueba);
IdocDataRec40.Insert(structureIdocDataRec40);
structureIdocDataRec40.SetValue("SEGNAM", "E1STATE");
structureIdocDataRec40.SetValue("MANDT", "");
structureIdocDataRec40.SetValue("DOCNUM", "0000000002322526");
structureIdocDataRec40.SetValue("SEGNUM", "1");
structureIdocDataRec40.SetValue("PSGNUM", "");
structureIdocDataRec40.SetValue("HLEVEL", "");
string prueba2 = "000000000232252614I0";
structureIdocDataRec40.SetValue("SDATA", prueba2);
IdocDataRec40.Insert(structureIdocDataRec40);
RFCIdoc_Inbound.SetValue("IDOC_DATA_REC_40", IdocDataRec40);
RFCIdoc_Inbound.Invoke(_rfcDestination);
And this is the content of the IDOC which i want to send:
- <ALEAUD01>
- <IDOC BEGIN="1">
- <EDI_DC40 SEGMENT="1">
<TABNAM>EDI_DC40</TABNAM>
<MANDT>300</MANDT>
<DOCNUM>0000000000318807</DOCNUM>
<DOCREL>700</DOCREL>
<STATUS>01</STATUS>
<DIRECT>1</DIRECT>
<OUTMOD>2</OUTMOD>
<IDOCTYP>ALEAUD01</IDOCTYP>
<MESTYP>ALEAUD</MESTYP>
<STDMES>ALEAUD</STDMES>
<SNDPOR>COLORS_P</SNDPOR>
<SNDPRT>LI</SNDPRT>
<SNDPRN>ICC0167</SNDPRN>
<RCVPOR>SAPPXC</RCVPOR>
<RCVPRT>LS</RCVPRT>
<RCVPRN>DLFSP0C100</RCVPRN>
<CREDAT>20110316</CREDAT>
<CRETIM>144959</CRETIM>
<ARCKEY>4D8013A0702F040BE1008000889E09E4 0000000002263837</ARCKEY>
</EDI_DC40>
- <E1ADHDR SEGMENT="1">
<MESTYP>ALEAUD</MESTYP>
<MESTYP_LNG>ALEAUD</MESTYP_LNG>
- <E1STATE SEGMENT="1">
<DOCNUM>0000000002322526</DOCNUM>
<STATUS>14</STATUS>
<STATYP>I</STATYP>
<STAMNO>0</STAMNO>
</E1STATE>
</E1ADHDR>
</IDOC>
</ALEAUD01>
I don't see what is the problem, but i get this error when i execute it : "Segment E1STATE error, segmentnumber ' ' not correct"
Please, can you help me to solve the mapping between the IDOC's xml and the asignment of the values to the structure?
Best regards,
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.