This sample shows how to create and send a MATMAS IDoc.
Note
This sample only creates basic data. To add more sophisticated data, look up the IDoc documentation via SAP transaction WE60 to find out more about the segments.
usingSystem;usingERPConnect;// Set your ERPConnect licenseLIC.SetLic("xxxx");usingvarconnection=newR3Connection(host:"server.acme.org",systemNumber:00,userName:"user",password:"passwd",language:"EN",client:"001"){Protocol=ClientProtocol.NWRFC,};connection.Open(false);ERPConnect.Idocs.Idocid=con.CreateEmptyIdoc("MATMAS01","");// Fill header dataid.SNDPRN="ERPCONNECT";id.SNDPOR="ERPCONNECT";id.SNDPRT="LS";id.RCVPRN="ECW_00_800";id.RCVPRT="LS";id.MESTYP="MATMAS";// Fill basic dataERPConnect.Idocs.IdocSegmente1maram=id.CreateSegment("E1MARAM");e1maram.Fields["MATNR"].FieldValue="DEV003";// Material Numbere1maram.Fields["MTART"].FieldValue="FERT";// Material Typee1maram.Fields["MATKL"].FieldValue="001";// Material Groupe1maram.Fields["MEINS"].FieldValue="PCE";// Base Unit of Measuree1maram.Fields["MBRSH"].FieldValue="M";// Industry sectore1maram.Fields["BRGEW"].FieldValue="1";// Gross Weighte1maram.Fields["NTGEW"].FieldValue="1";// Net Weighte1maram.Fields["GEWEI"].FieldValue="KG";// Weight Unitid.Segments.Add(e1maram);// Fill text dataERPConnect.Idocs.IdocSegmente1maktm=id.CreateSegment("E1MAKTM");e1maktm.Fields["SPRAS"].FieldValue="E";// Language Keye1maktm.Fields["MAKTX"].FieldValue="my Article";// Description Texte1maram.ChildSegments.Add(e1maktm);// Send IDocid.Send();Console.WriteLine("Ready..");Console.ReadLine();