An IDOC (Intermediate Document) is an SAP object that carries data of a business transaction from one system to another, in the form of electronic message.
IDOC is the standard data structure for electronic data interchange (EDI) between an SAP application and an external application.
Depending on the direction it is sent, an IDOC can be triggered in the SAP system or in an external application.
Outbound flow: The IDOC is triggered in SAP, through document message control, and sent to an external application via middleware that converts the data from IDOC into cXML, or equivalent format. After the IDOC is converted, the data is then sent to the external application.
Inbound flow: cXML is converted to an IDOC. After successful processing of this IDOC, Application Document is posted in SAP.
*IDOCs are always asynchronous communications.
*IDOC Types are based on EDIFACT standards.
All fields that are necessary for the transmission of a message for a particular business transaction are mapped in different segments.

Basic type: Defines the structure of an IDOC. Each basic type describes standard IDOC segments, format of data fields and their size.
Message Type: Type of document

Control Record contains type of IDOC, port of partner, release of SAP System.
Data records contain application specific data. Example: PO header, line item information.
Status records are used to store the status of the document.