!--a11y-->
SAPIDocSender
Class 
The SAPIDocSender class is a TRFC client used to submit SAP intermediate documents to an SAP system for later processing. An example of an IDOC might be a customer sales order or a material master record. IDOC records are typically used in EDI scenarios. See the IdocSubmit sample for example code.
|
[C#] public class SAPIDocSender : SAP.Connector.SAPClient |
Public Constructors
|
public SAPIDocSender (System.String ConnectionString) |
Creates a new instance of SAPIDocSender with a connection string |
|
public SAPIDocSender ( ) |
Creates a new instance of SAPIDocSender and set the connection in a later step |
Public Methods
|
public void SubmitIDoc (System.String iDocPath , SAP.Connector.RfcTID tid) |
Submits an IDOC from an IDOC stored as a file on the operating system |
|
public void SubmitIDoc (System.IO.TextReader iDoc , SAP.Connector.RfcTID tid) |
Submits an IDOC from an IDOC as a textreader object. Perhaps from another application or built dynamically |
|
public void TRfcIDocInBoundAsynchronous (SAP.Connector.EDI_DC40_BLOCKList iDocControlRec40 , SAP.Connector.EDI_DD40_BLOCKList iDocDataRec40 , SAP.Connector.RfcTID tid) |
Offers more granular control over the different pieces of the IDOC (EDIDC and EDIDD) for example when you are creating an IDOC manually or changing something in the header but otherwise want to keep the body of the IDOC |
Remarks
An IDOC will consist of three segments, the header (EDIDC), the body (EDIDD) and the status (EDIDS). The EDIDC record can contain two formats (EDIDC or EDIDC40) depending on the version of the IDOC. The body of the IDOC will differ depending on what IDOC type and release it is. The status record is only maintained inside of the SAP system and is not relevant to submit an IDOC.
Example
|
private SAP.Connector.SAPIDocSender sapiDocSender1; private void SubmitIdoc() { // submit to SAP via trfc RfcTID myTid = RfcTID.NewTID(); try { sapiDocSender1.ConnectionString = destination1.ConnectionString; sapiDocSender1.SubmitIDoc(@”C:\temp\idoc.txt”,myTid); sapiDocSender1.ConfirmTID(myTid); MessageBox.Show("Idoc was submitted to SAP, look at transaction WE02 in SAP","idoc status"); } catch (Exception ex) { MessageBox.Show("Problem submitting IDOC to SAP\n" + ex.ToString()); } } //submitIdoc() |