The IDoc class of ERPConnect offers support for both the IDoc schema and IDoc data located in XML-files.
Note: IDoc schema files contain the structure of an IDoc while IDoc data files contain the actual content of the IDoc.
How to Create XML Files for IDocs #
To create an IDoc schema file, use the Theobald tool IDocSchemaGenerator.exe, see IDoc-Schema-Generator.
A simple IDoc data file that contains the content of an ORDERS01 IDoc can look like this:
xml version="1.0" encoding="ISO-8859-1" ?>
- <ORDERS01>
- <IDOC>
- <EDI_DC40>
<TABNAM>EDI_DC40TABNAM>
<IDOCTYP>ORDERS01IDOCTYP>
<MESTYP>ORDERS>MESTYP>
<SNDPRT>KUSNDPRT>
EDI_DC40>
<E1EDK01 />
- <E1EDK01>
<MENGE>10MENGE>
- <E1EDP10>
<QUALF>002QUALF>
<IDTNR>100-100IDTNR>
E1EDP19>
How to Load XML Files #
- Use the method LoadIdocSchema tool to create an IDoc object from a schema file.
- Create segment objects using CreateSegment.
- Load the IDoc data from a data file with the method LoadXMLData.
Sample Code
The following C# code shows how to load and send data from files.
using (R3Connection con = new R3Connection("SAPServer", 00, "SAPUser", "Password", "EN", "800"))
{
Idoc i = new Idoc();
i.Connection = con;
i.LoadIdocSchema(@"ORDERS01.xsd");
i.LoadXMLData(@"OrderIdoc.xml");
i.Send();
}