IDoc Basics For Functional Consultants
IDoc Basics For Functional Consultants
OVERVIEW
IDoc is an SAP object that carries data of a business transaction from one system
to another in the form of electronic message.
The transfer from SAP to non-SAP system is done via EDI (Electronic Data
Interchange) subsystems whereas
Transfer between two SAP systems, ALE is used.
IDoc can be triggered in SAP system or in EDI subsystem. This depends on the
direction in which IDoc is sent and is called as Inbound IDoc and Outbound IDoc
accordingly.
For inbound flow, EDI converts partner data and IDoc is created in SAP. After
successful processing of this IDoc, Application Document is posted in SAP.
EDI STANDARDS AND IDOC
IDoc Types are based on the EDI standards and mostly on EDIFACT standards.
An IDOC is an instance of an IDOC Type , just like the concept of variables and
variables types in programming languages. You can define IDOC types using WE30
IDOC TERMINOLOGIES
Each basic type describes standard IDoc segments, format of data fields and their
size.
All the fields that are necessary for transmission of message for a particular
business transaction are mapped in different segments.
It also defines the structure and relationship of IDoc segments along with
mandatory and optional segments.
IDOC EXTENSION
Basic type contains all the standard fields that are necessary for carrying out a
business transaction. However, if any additional values are to be sent to the
partner then we can make use of the IDoc Extension feature. IDoc extension is
extension of basic type and contains additional custom IDoc segments and fields
that are not available in standard basic type.
As seen the screenshot above IDOC record has three parts Control, Data and
Status. Let's look into them in detail - Control Record
All control record data is stored in EDIDC table. The key to this table is the IDOC
Number
It contains information like IDOC number, the direction(inbound/outbound),
sender, recipient information, channel it is using, which port it is using etc.
Direction '1' indicates outbound, '2' indicates inbound.
Data Record
Data record contains application data like employee header info, weekly details,
client details etc
All data record data is stored in EDID2 to EDID4 tables and EDIDD is a structure
where you can see its components.
It contains data like the idoc number, name and number of the segment in the
idoc, the hierarchy and the data
The actual data is stored as a string in a field called SDATA, which is a 1000 char
long field.
Status Record
Status record is attached to an I-DOC at every milestone or when it encounter
errors.
All status record data is stored in EDIDS table.
Statuses 1-42 are for outbound while 50-75 for inbound
IDOC SEGMENTS
IDoc segments contain the actual data that is sent to or received from a partner.
These segments contain the actual values that are sent as part of IDoc
transmission.
IDOC DIRECTION
This signifies the direction is which information is sent and is similar to
terminology used in mails. If information is sent outside the system then the
direction is outbox when it is received into the system then direction is
inbox. In SAP Outbox direction is represent by “1” i.e. outbox and Inbox
direction is represented by “2”.
PARTNER
Partner is the Business Partner with which the exchange of information is
to take place using IDoc. It can be a vendor or customer or any other
system. Depending on the direction of information in which the information
is sent it plays a role of either a “sending partner” or a “receiving partner”.
PARTNER TYPE
Partner type/role is used to identify partners within the sap systems.
Partner type is KU for customer, LI for vendor and LS for Logical System.
MESSAGE TYPE
IDoc processing involves transmission or receipt of document in the form of
a message, each of which represents a document in SAP. These
documents can be Order, Shipment Confirmation, Advance Shipping
Notification, Goods Receipt, or Invoice. Message type is associated with
Basic IDoc Type (Basic Type) and defines the kind of data or document
that is exchanged with the partner.
PROCESS CODE
The process code contains the details of the Function Module that are used
for IDoc processing. Message Type can be linked to the Process code.
PORT
IDoc Port contains the information about the way data is sent between the
source or target system. The type of port defines the information contained
within the port. For port type “Internet” Port will contain IP address of the
target system. For port type “file”, directory or file name information is
maintained. “tRFC” port contains information about the RFC destination of
the target system. For IDoc transmission using ALE “tRFC” ports are used.
PARTNER PROFILE MAINTENANCE
These records are stored in the transparent tables in SAP. These are
EDIDC, EDID4 and EDIDS.
CONTROL RECORD (EDIDC)
It contains information such as IDoc number, direction, IDoc Status, Basic
Type, Message Type, Partner (Sender/Receiver), date and time of
creation/update, Interchange File or ISA number,etc.
DATA RECORD (EDID4)
It contains the details of the IDoc segments.
IDoc segment has fields that contain the data necessary for posting the
documents.
STATUS RECORDS (EDIDS)
IDoc Status defines the processing status of the IDoc. IDoc statuses are
used to track the IDoc and its various processing states. Status Numbers
represents IDoc status. Current status of the IDoc is present in Control
record.
Initial Status numbers are 64 for inbound and 03 for outbound. Successful
status is 53 for inbound and 16 for outbound IDocs.
SENDING AND RECEIVING IDOCS
TRIGGERING AN OUTBOUND IDOC
Outbound IDocs can be triggered from the output message types of
Purchase Orders, deliveries, Material Documents, invoices, etc. The
following figure shows that once the output ZXX1 of PO XXXXXXX1 is
processed an IDoc “000000XXXXXXXXX1” is added/created.
The relationship between the IDoc and the application document can be
found in two ways:
1. Relationship tab of IDoc
2. Relationship tab of Application Document, e.g. PO, SO, Material
Document, etc.
The initial status of this IDoc will be 30, which after successful processing
will convert into status 16.
A successful outbound IDoc will pass through all the above statuses in
reverse order (01-03-18-06-12-16). Each status represents an IDoc
validation step. If an IDoc passes all the validations it would reach status
16. These different validation steps for outbound IDocs are explained
below:
01: IDoc generation successful
30: IDoc is ready to be processed by IDoc Processing job
03: IDoc data is passed to the Port
18: IDoc successfully triggered EDI subsystem
06: IDoc data translated to EDI format
12: IDoc is dispatched successfully to the partner
16: Partner has received the IDoc successfully
IDoc can possibly fail at any of the above steps during validation.
RECEIVING AN INBOUND IDOC
The initial status of an inbound IDoc is 64 and successful status is 53.
Different validation steps for inbound IDocs are explained below:
50: IDoc received successfully in the system
64: IDoc is ready to be processed by IDoc processing job
53: Application document created and saved successfully. The document
number can be found by expanding the status node 53
An inbound IDoc goes through all the above statuses in reverse order (50-
64-53).
IDOC PROCESSING
AUTOMATIC/IMMEDIATE PROCESSING
In this case, IDoc are processed immediately as they generated or added
in the system. The check “Transfer IDoc immediately” is selected in
Outbound Options and “Trigger Immediately” is selected in Inbound Option.
These checks are generally used when the real time information exchange
is necessary between two systems.
MANUAL PROCESSING
IDocs can also be manually processed using the TCODE BD87 in SAP.
PROCESSING VIA BACKGROUND JOB
IDoc processing by background is the most preferred way of processing the
IDocs. Following Programs are used from processing the IDocs using
background job:
RBDAPP01 – Inbound IDocs
RSEOUT00 – Outbound IDocs
REPROCESSING IDOCS
On the basis of IDoc statuses different programs can be used for
reprocessing of failed IDocs. These are given below:
SEARCHING IDOCS IN SAP
TCODE WE02/WE05: GENERAL SEARCH
IDocs can be displayed in system via TCODE WE02 and WE05. If IDoc
number is not known then search can be made on the basis of IDoc Date,
Direction, BASIC TYPE, MESSAGE TYPE, and PARTNER
NUMBER. Partner number can be found in the Output Messages of the
documents.
IDoc search can also be made on the basis of ISA or Transfer file
Reference.
TCODE WE09: SEARCHING DATA IN IDOC SEGMENTS
If we are looking for specific information within the IDocs Segments then
this can be found using TCODE WE09. This is useful if you are searching
for a particular information in similar kind of IDoc within IDoc segments. For
example, if you want to search a particular Purchase Order number e.g.
100000001 in multiple IDocs which lies in Segment E1EDK01 of an IDoc
under field BELNR. Then the search can be executed in the following
manner.
What is a Segment?
A Segment defines the format and structure of a data record in I-DOC.
Segments are reusable components.
Definitions keep changing as per the version but the segment type remains
the same.
Transaction:WE31
1. Basic
2. Extension
SAP provides many a pre-defined Basic IDOC Types which can not be
modified. In case you want to add more data to these restricted basic type
you may use an extension type. Most of the times you will NOT use extension.
Documentation
Each IDOC are thoroughly documented in transaction WE60
Message Type
A message represents a specific type of document that is transmitted between
two partners Ex. Orders, orders responses, invoices etc
There are different types of ports. The 2 most commonly used are the TRFC
ports used in ALE and File ports which EDI uses.
For TRFC ports we have to give the name of the logical destination created
using SM59.
When using file port you can specify the directory where the IDOC file should
be placed. The other system or the middleware will pick up the file from here.
The Function module can be used to generate a file name for the idoc.
While Testing you can use "Outbound file" to specify a constant file name.
The tab "outbound trigger" can be used to supply information if we want to
trigger some processing on the subsystem when an idoc is created at this
location. We have to specify the command file name and the directory which
has to be run.
This is so CONFUSING!
Let's understand the process of creating an IDOC with an example -
The process of data transfer out of your SAP system is called the Outbound
process, while that of data moving into you SAP system is called Inbound
process. As a developer or a consultant who will be involved in setting up
theses process for your organization. Here are the steps how to set them up-
The Outbound Process
Steps Involved -
1. Create segments(WE31)
2. Create an idoc type(WE30)
3. Create a message type (WE81)
4. Associate a message type to idoc type(WE82)
5. Create a port(WE21)
6. If you are going to use the message control method to trigger idocs then
create the function module for creating the idoc and associate the
function module to an outbound process code
7. Otherwise, create the function module or stand-alone program which
will create the idoc
8. Create a partner profile(WE20) with the necessary information in the
outbound parameters for the partner you want to exchange the idoc
with.Trigger the idoc.