SAP IDoc Fundamentals for Functional Consultants

created by Niranjan Nagle on Dec 31, 2012 11:30 AM, last modified by Niranjan Nagle on Oct 23, 2013 4:38 PM
Version 14

Abstract

IDocs are used in most SAP applications for the transfer of messages from SAP to other systems and vice versa. A lot of documentation is available on the web for IDocs, but most of it is technical in nature. This document is written from the perspective of a functional consultant and will help in dealing with support issues related to IDocs. An effort has been made to capture all the necessary information about IDocs that a functional consultant needs to be aware of.


IDoc Overview

An IDoc is an SAP object that carries data of a business transaction from one system to another in the form of an electronic message. IDoc is an acronym for Intermediate Document. The purpose of an IDoc is to transfer data or information from SAP to other systems and vice versa. The transfer from SAP to non-SAP systems is done via EDI (Electronic Data Interchange) subsystems, whereas ALE is used for transfer between two SAP systems.

An IDoc can be triggered in the SAP system or in the EDI subsystem. This depends on the direction in which the IDoc is sent and is called an Inbound IDoc or Outbound IDoc accordingly. In the case of outbound flow, the IDoc is triggered in SAP through document message control, which is then sent to the EDI subsystem. EDI converts the data from the IDoc into XML or an equivalent format and then sends the data to the partner system through the Internet.

For inbound flow, EDI converts partner data, and an IDoc is created in SAP. After successful processing of this IDoc, the Application Document is posted in SAP.

1.png

EDI Standards and IDoc

“EDI is the electronic exchange of business documents between the computer systems of business partners, using a standard format over a communication network.” EDI stands for Electronic Data Interchange.

For the electronic transmission of information, two widely used standards are ANSI ASC X12 and EDIFACT. ANSI ASC X12 is a committee formed by representatives of major organizations, government bodies, and EDI software companies which defines standards and guidelines for information interchange over EDI. UN/EDIFACT stands for United Nations EDI for Administration, Commerce and Transport and was formed in 1985 using ANSI X12 and UNTDI (United Nations Trade Data Interchange) as base standards. ANSI X12 describes business documents as transactions, and each transaction is represented by a three-digit number, e.g., 850 – Purchase Order, 855 – Purchase Order Acknowledgement. EDIFACT describes business documents as messages, represented by standard names, e.g., ORDERS for purchase order.

IDoc Terminologies

IDoc Basic Type

IDoc Types are based on the EDI standards, mostly on EDIFACT standards. Basic Types (or IDoc Type) define the structure of an IDoc. Each basic type describes standard IDoc segments, the format of data fields, and their size. The Basic Type also defines the number of segments and fields in an IDoc. All the fields that are necessary for the transmission of a 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.

2.png

IDoc Extension

The 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 an extension of the basic type and contains additional custom IDoc segments and fields that are not available in the standard basic type.


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.

3.png

Parent and Child Segments

An IDoc segment is termed a Parent segment if it contains its own segments. The dependent segments are called child segments.

4.png


Inbound and Outbound IDocs

IDocs sent outside the system are termed Outbound IDocs, and the ones received into the system are called Inbound IDocs.

5.png

IDoc Direction

This signifies the direction in which information is sent and is similar to terminology used in emails. If information is sent outside the system, the direction is outbox; when it is received into the system, the direction is inbox. In SAP, the Outbox direction is represented by “1” (outbox) and the Inbox direction is represented by “2” (inbox).

6.png

Partner

A Partner is the Business Partner with which the exchange of information is to take place using IDoc. It can be a vendor, a customer, or any other system. Depending on the direction in which the information is sent, the partner plays the role of either a “sending partner” or a “receiving partner”.

7.png

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.

8.png

Message Type

IDoc processing involves the transmission or receipt of a 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 the Basic IDoc Type and defines the kind of data or document exchanged with the partner.

Process Code

The process code contains the details of the Function Module used for IDoc processing. Message Type can be linked to the Process code.


Port

The IDoc Port contains 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”, the Port will contain the 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

Partner Profile (WE20)

A Partner profile must be maintained for all the business partners to whom we want to send or receive IDocs. The T-code for maintaining the partner profile is WE20.

9.png

Double clicking on the Partner will show the following screen:

20.png

The Partner profile contains parameters for Inbound and Outbound processing of IDocs. For each message type, we can maintain inbound/outbound options, message control, post processing options, and contact information within Inbound and Outbound parameters.

Outbound Options (Outbound Parameters)

This involves the sender/receiver port, Output mode, and relation to the IDoc type (i.e., Basic Type and extension).

21.png

Message Control (Outbound Parameters)

This contains the application for which the IDoc will be created (e.g., EF for Purchase Order), the message type of the application that will trigger the IDoc, and the Process Code that will convert the SAP document to an IDoc. For example, if a PO is to be sent to Vendor AXXXXZ, then in the outbound option of partner AXXXXZ, we need to maintain the message type ZXX1 and link it to the Process Code ME10. So when message type ZXX1 is triggered in the PO, an IDoc will be created for the partner vendor AXXXXZ.

The Process Code is linked to the Function Module in SAP that converts application data into an IDoc. Standard function modules are provided by SAP for this conversion; however, these can also be customized as per business needs.

22.png

Change Message Indicator indicates whether the IDoc is sent as a notification of change. For example, Purchase Order change messages are sent to the vendor using EDI standard message type 860.

24.png

A separate message type should be triggered in the Purchase Order for PO changes. An additional line with the change message type must be added in the Message Control tab with the Change Message indicator on.

10.png

Inbound Options (Inbound Parameters)

For inbound options, the process code is maintained in the Inbound screen only. IDoc processing can be triggered by a background program or triggered immediately.

11.png

Post Processing (Inbound/Outbound Parameters)

In the Post Processing option, we can maintain the workflow details of the users or positions to which an error notification will be sent if IDoc processing fails.

25.png

Telephony (Inbound/Outbound Parameters)

We can also maintain the contact details in the Telephony option.

12.png

EDI Standard (Outbound Parameters)

The EDI Standard screen contains the details of the standard EDI terminology used for IDoc transmission.

26.jpg

For example, Message Type 850 is an EDI standard for Purchase Order IDoc and is linked to IDoc Message Type Orders.


IDoc Structure and Records

Structure

The IDoc structure is divided into Control Record, Data Records, and Status Records.

27.png

These records are stored in the transparent tables in SAP: 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.

28.png

29.png

Data Record (EDID4)

It contains the details of the IDoc segments.

30.png

The IDoc segment has fields that contain the data necessary for posting the documents.

31.png

32.png

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 represent IDoc status. The current status of the IDoc is present in the Control Record.

33.png

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.

34.png

The relationship between the IDoc and the application document can be found in two ways:

  1. Relationship tab of IDoc

35.png

36.png

  1. Relationship tab of Application Document, e.g., PO, SO, Material Document, etc.

37.png

The initial status of this IDoc will be 30, which after successful processing will convert to status 16.

38.png

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

An 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 the 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

39.png

40.png

An inbound IDoc goes through all the above statuses in reverse order (50-64-53).

IDoc Processing

Automatic/Immediate Processing

In this case, IDocs are processed immediately as they are generated or added in the system. The check ‘Transfer IDoc immediately’ is selected in Outbound Options, and ‘Trigger Immediately’ is selected in Inbound Options. These checks are generally used when real-time information exchange is necessary between two systems.

41.png

13.png

Manual Processing

IDocs can also be manually processed using the T-code BD87 in SAP.

Processing via Background Job

IDoc processing via background job is the most preferred way of processing IDocs. The following programs are used for processing IDocs using a background job:

  • RBDAPP01 – Inbound IDocs
  • RSEOUT00 – Outbound IDocs

Reprocessing IDocs

Based on IDoc statuses, different programs can be used for reprocessing failed IDocs. These are given below:


pastedImage_18.png

Testing and Editing IDocs

If an IDoc contains errors in the data, such IDocs can be edited using T-code WE02 or WE05. When an IDoc is edited, the original IDoc information (backup) is saved in a new IDoc under status 70 (for inbound) / 33 (for outbound). These IDocs stay in the system for reference only and cannot be processed. The status of the edited IDoc becomes 69 (inbound) and 32 (outbound). These IDocs can then be processed using the BD87 transaction or batch jobs.

Debugging of IDocs can be done by copying the IDocs using T-code WE19. WE19 is a test tool for IDoc processing. WE19 copies the existing IDoc and creates a new IDoc which can then be modified as per testing needs. The newly generated IDoc can also be processed using BD87.

Converting IDoc Status

Report RRC1_IDOC_SET_STATUS can be used to change the status of an IDoc. Status changes are generally needed to move an IDoc to status 68 (‘no further processing’).

14.png

Searching IDocs in SAP

T-code WE02/WE05: General Search

IDocs can be displayed in the system via T-code WE02 and WE05. If the IDoc number is not known, the search can be made based on IDoc Date, Direction, Basic Type, Message Type, and Partner Number. The Partner number can be found in the Output Messages of the documents.

15.png

42.png

IDoc search can also be made based on the ISA or Transfer File Reference.

16.png

T-code WE09: Searching Data in IDoc Segments

If you are looking for specific information within the IDoc Segments, this can be found using T-code WE09. This is useful if you are searching for particular information in similar kinds of IDocs within IDoc segments. For example, if you want to search for 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.

43.png

IDoc Validations, Common Errors, and Solutions

17.png

Though IDoc failure may not be related to any of the above-mentioned reasons, the best way to find the IDoc error is to compare the existing IDoc with a good example. A good example IDoc can be easily searched using any of the IDoc search methods described above.


Documentation for IDoc Types (WE60)

IDoc documentation can be found using T-code WE60 and can be helpful to obtain information about the IDoc Type or its particular segment. It also provides information such as mandatory and optional segments, minimum and maximum number of segments, etc.

44.jpg

Common IDoc Message Types and Basic Types

The following list gives the Basic Type and Message Type combination for common IDocs:


pastedImage_79.png

Archiving and Deletion of IDocs

As IDocs grow older, they are archived and deleted from the database. Archived IDocs can be viewed using T-code SARI in Archive Explorer, using the archiving object IDoc. The following programs are used for archiving and deletion of IDocs from the database.

pastedImage_90.png