The example below shows how to send a STATUS IDoc.
About
The STATUS message type is used to manipulate the status of another outbound IDoc e.g., when a subsystem receives an IDoc and acknowledges the receive with a status change. STATUS is a simple IDoc that contains only one data record.
Note
Make sure to configure your SAP system to receive IDocs.
Send a STATUS IDoc
Follow the steps below to send a STATUS IDoc:
Connect to the SAP system using R3Connection.
Inquire the IDoc number of the IDoc to be manipulated and read the input.
Use CreateIdoc to instance a valid IDoc object. "SYSTAT01" is the IDoc type for the appropriate message type STATUS.
usingSystem;usingERPConnect;usingERPConnect.Utils;// 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();// Inquire the IDoc number of the IDoc to be manipulated and read the input. Console.WriteLine("Which IDoc number would you like to manipulate?");stringIdocNo=Console.ReadLine();Idoci=connection.CreateIdoc("SYSTAT01","");// Fill Message Type i.MESTYP="STATUS";// Fill Information about IDoc Reciever i.RCVPRN="PT4_800";// Partner number i.RCVPRT="LS";// Partner type // Fill information about IDoc sender i.SNDPOR="ERPCONNECT";// Partner port i.SNDPRN="ERPCONNECT";// Partner number i.SNDPRT="LS";// Partner type// Fill the right fields in the segments i.Segments["E1STATS",0].Fields["LOGDAT"].FieldValue="20210901";i.Segments["E1STATS",0].Fields["LOGTIM"].FieldValue="152301";i.Segments["E1STATS",0].Fields["STATUS"].FieldValue="12";i.Segments["E1STATS",0].Fields["DOCNUM"].FieldValue=IdocNo;i.Send();Console.WriteLine("IDoc sent");Console.ReadLine();
Output:
The status code of the manipulated IDoc increases from 3 (Data passed...) to 12 (Dispatch OK).