The IDoc (Intermediate Document) structure in SAP is designed to facilitate the exchange of business data between systems.
It has a hierarchical structure divided into three main components:
1. Control Record (EDIDC)
The control record provides metadata about the IDoc and serves as a header. It contains information required for processing and routing the IDoc.
Key Fields in the Control Record:
- IDoc Number: A unique identifier for the IDoc.
- Direction: Specifies whether the IDoc is inbound (2) or outbound (1).
- Message Type: Defines the type of business process (e.g.,
ORDERS
,INVOIC
). - Basic Type: Specifies the structure of the IDoc (e.g.,
ORDERS05
,INVOIC02
). - Sender/Receiver Information: Includes:
- Partner Type (e.g.,
KU
for customer,LI
for vendor). - Partner Number (identifies the trading partner).
- Logical System (represents SAP or external systems).
- Partner Type (e.g.,
- Status: Tracks the current state of the IDoc (e.g., created, sent, processed, or error).
2. Data Records (EDID4)
The data records contain the actual transactional data. They are organized into segments, which represent logical groups of data.
Structure of a Data Record:
- Segment ID: Identifies the segment type (e.g.,
E1EDK01
for header data). - Parent Segment: Links child segments to their parent for a hierarchical relationship.
- Segment Data: Contains the field values in a flat structure.
Types of Segments:
- Header Segment: Contains general information, such as document date, document type, and trading partner details.
- Example:
E1EDK01
(Header Data)
- Example:
- Item Segments: Holds line-item-specific details, such as product, quantity, and price.
- Example:
E1EDP01
(Item Data)
- Example:
- Summary Segments: Provides totals or summaries for the document.
- Example:
E1EDT01
(Totals Data)
- Example:
Segments can be mandatory or optional, depending on the IDoc type and the business process.
3. Status Records (EDIDS)
The status records track the lifecycle of the IDoc, providing information about its processing status.
Key Fields in Status Records:
- Status Code: Indicates the current state of the IDoc.
- Examples:
03
: Outbound IDoc sent to the partner system.12
: Inbound IDoc successfully processed.51
: Inbound IDoc with errors during processing.
- Examples:
- Timestamp: Records when the status change occurred.
- Message: Describes the status or any error encountered.
Hierarchical Relationship in IDoc
IDocs follow a hierarchical structure:
- Control Record: One per IDoc.
- Data Records: One or more, depending on the transaction.
- Data records can have a parent-child relationship (e.g., header → item → sub-item).
- Status Records: One or more, as the IDoc moves through its lifecycle.
No comments:
Post a Comment