Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
Showing results for 
Search instead for 
Did you mean: 

about idoc

Former Member
0 Kudos

can anyone provide step by step idoc programming in abap with explaination

both inboound and outbound

and also terms used in idoc like message type why they were used etc


Former Member
0 Kudos

Hi Vijay,

IDoc Definition:An intermediate document (IDoc) is a container for exchanging data between R/3, R/2 and non-SAP systems.


ALE uses IDoc to exchange data between logical systems. Non SAP-systems can use IDoc as the standard interface for data transfer. IDoc are created by message types and (object) methods when data is to be distributed.


An IDoc represents a configuration of an IDoc type that determines the IDoc structure. An IDoc consists of a header, several data segments and status records.The functions of the individual elements of an IDoc are as follows:

The contents, structure, sender, receiver and current status of the IDoc are defined in the IDoc header.

Each data segment contains a standard header consisting of a sequential segment number, a description of the segment type and a 1000 character long string field containing the actual data of the segment. The status records show the history of the processing steps applied to the IDoc so far. The structure of the IDoc is recorded in the SAP System. The structure definition covers the

following: The segment sequence. Hierarchical relationships between segments are possible. The number of times a segment can occur is specified for each segment, as is whether the segment is a mandatory segment or an optional segment. The fields cont ained in a segment. In the example shown above the IDoc contains a header segment that has to be the first segment of the message.

Thereafter there must be at least one additional item. The following conditions apply:

Each item must be followed by at least one sub-item and at most 99

Up to 9999 text segments can appear after an item's sub-items (optional)

The last segment in a message must be an accumulation segment (ACCUM)

An IDoc can only contain character fields.

Modeling Distribution:


To implement the distribution of business application processes and functions using ALE you need to construct a logical Distribution Model of the whole system. Within the framework of this configuration customers can specify what applications are to run on what systems and what messages are to be exchanged between the applications .

Distribution Model:

Definition: The distribution model describes the ALE message flows between logical systems.


You can specify the relationships between logical systems, message types, BAPIs and filters inthe distribution model. Applications and the ALE layer use the model to determine the receivers and to control data distribution.


In the distribution model you can specify the messages to be sent to a logical system. You can also define requirements for message content and dispatch in the Filters. The distribution model consists of one or more views that you can define. With more complex distribution tasks you can assign business sub-areas or groups of logical systems to separate views. To ensure correct functioning the relevant views of the distribution model must be available in all the logical systems involved in ALE. You can find the functions for distributing views in Customizing for ALE.

Creation of Custom IDOc type and message Type

First Create Partner Profile(WE20 Tcode) and Port Definition in WE19 Tcodes.

take the Basis help to create them.

1.First create segments in WE31 Tcode with the required dataelements

2.Create the Basic Idoc Type in WE30

release the Segments and IDOC type.

3.Create Message type in We81

4.Assign the message type to IDOC type in WE82 T code

5.Create the process code in We41 (for Outbound) WE42 (for Inbound)

6.Create A fun module in SE37 starting with ZIDOC_OUTPUT_.. by copying some Inbound (for Inbound) Outbound Fun module

7.Create Workflow setting if needed ..

8. Assign the fun module to Idoc Type, Message Type and WF object (if it is there)

9.Define setting for fun module in BD51

10.In BD51 Define the settings for Fun module..

10.Assign the Processs Code to Fun mod`ule


Step 1. Application document is created when transaction is saved.

2. Message control is invoked.

3. Messages are processed by system.

4. Messages are Edited (if desired).

5. Output (ALE / EDI) is checked

6. Validate against Message control record from Partner Profile

7. Application Document is saved.

8. Entry NAST table is created for every selected output program

along with Medium & Timing.

9. Check for Process Immediately .

If (yes)

Determine Processing Program from TNAPR Table.


Execute RSNASTED Program.

10. Read Partner Profile to determine Process Code.

11. Process Code points to the Function Module & Invoked.

12. IDoc is generated.

13. Check for ALE Request.

if (Yes)

Perform Filters, Conversions, Version Changes etc.


IDoc is stored in DATABASE.


Step 1. EDI Subsystem creates an IDoc file from EDI Messages

2. Subsystem calls Functional Module EDI_DATA_INCOMING from startRFC program.

3. Data in Control Record is validate against the Partner Profile.

4. IDoc is generated in Database and syntax check is carried out.

5. IDoc file is deleted once file read.

6. Event PROCESSSTATE REACHED is triggered in Idoc Object Workflow.

7. Check for Process Immediately.


Execute RBDAPP01 Program


Read Process Code from Partner Profile

Process Code Points to Function Module

Application Document Posted.

ALE/ IDOC Links,295197,sid63_tax296858_idx0_off...


<b>Reward Points if useful</b>