SAP IDOC Tutorial: Definition, Structure, Types, Format & Tables

What is an IDOC?

IDOC is simply a data container used to exchange information between any two processes that can understand the syntax and semantics of the data.

In other words, an IDOC is like a data file with a specified format which is exchanged between 2 systems which know how to interpret that data.

IDOC stands for " Intermediate Document"

When we execute an outbound ALE or EDI Process, an IDOC is created.

In the SAP System, I DOCs are stored in database. Every IDOC has a unique number(within a client).

In this tutorial you will learn:

Key Features

Structure of an IDOC

SAP IDOC Tutorial: Definition, Structure, Types, Format & Tables



The I doc structure consists of 3 parts -

  1. The administration part(Control Record)- which has the type of idoc, message type, the current status, the sender, receiver etc. This is referred to as the Control record.
  2. The application data (Data Record) - Which contains the data. These are called the data records/segments.
  3. The Status information (Status Record)- These give you information about the various stages the idoc has passed through.

You can view an I-DOC using transaction WE02 or WE05

SAP IDOC Tutorial: Definition, Structure, Types, Format & Tables

As seen the screenshot above IDOC record has three parts Control, Data and Status. Let's look into them in detail - Control Record

Data Record

Status Record

IDOC Types

An I DOC Type, (Basic) defines the structure and format of the business document that is to be exchanged. 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
 

What is a Segment?

A Segment defines the format and structure of a data record in I-DOC. Segments are reusable components.

For each segment SAP creates

The last 3 characters is the version of the segment

Definitions keep changing as per the version but the segment type remains the same.

Transaction:WE31

SAP IDOC Tutorial: Definition, Structure, Types, Format & Tables

Port

The port defines the technical characteristics of the connection between your SAP system and the other system you want to transfer data with (subsystem). The port defines the medium in which data is exchanged between the 2 systems.

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.

SAP IDOC Tutorial: Definition, Structure, Types, Format & Tables

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.

The Inbound Process

Steps Involved-

  1. Creation of basic Idoc type (Transaction WE30)
  2. Creating message type (Transaction WE81)
  3. Associating the Message type to basic Idoc type (Transaction WE82)
  4. Create the function module for processing the idoc
  5. Define the function module characteristics (BD51)
  6. Allocate the inbound function module to the message type(WE57)
  7. Defining process code (Transaction WE42)
  8. Creation of partner profile (Transaction WE20)

 

YOU MIGHT LIKE:
SAP Beginner

What is mySAP?

mySAP is not a single product but is a suite of products from SAP including SAP R/3 . SAP R/3 was...