100% found this document useful (1 vote)
102 views54 pages

Understanding IDoc: Structure & Processing

The document defines and explains the purpose and structure of IDocs. IDocs are structured ASCII files that contain distributed business data. They allow different application systems to exchange data asynchronously. IDocs have a control record, data records stored in segments, and status records. Proper configuration of ports, partner profiles, and process codes is required to define the communication between systems. Inbound processing retrieves IDoc data, while outbound processing sends data to another system in IDoc format.

Uploaded by

cha108224027088
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
102 views54 pages

Understanding IDoc: Structure & Processing

The document defines and explains the purpose and structure of IDocs. IDocs are structured ASCII files that contain distributed business data. They allow different application systems to exchange data asynchronously. IDocs have a control record, data records stored in segments, and status records. Proper configuration of ports, partner profiles, and process codes is required to define the communication between systems. Inbound processing retrieves IDoc data, while outbound processing sends data to another system in IDoc format.

Uploaded by

cha108224027088
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPT, PDF, TXT or read online on Scribd

IDoc

Intermediate Document
Agenda
Application
 Definition of IDoc
 Purpose of IDoc
 Definition of Terms 1 create
 IDoc Structure
 IDoc Interface Workflow
 Inbound Processing IDoc Interface
 Outbound Processing
status
 Ports, Partner and Process
Code Definition 2 transfer
3
 Development
 Running and Testing
 Monitoring Receiving System
Definition of an IDOC

Intermediate Document (IDOC)


- are structured ASCII files or a structure of segments,
such as headers and collection of data fields. The
structure can be SAP predefined or custom depending
on the need. IDOCs main purpose is to contain
distributed data.

- IDocs allow different application systems to be linked via


a message-based interface
IDoc Concept
Asynchronous
Document-related

System 1 System 2
IDoc
SAP  Document
Document  Transaction
 Message

 EDI System
 R/3 System
 R/3 System  R/2 System
 non-SAP
systems
IDoc Purpose
automatic processing of business
documents

simplify the structure of different


application systems

extensive exception handling before


the data are posted to the application
Definition of Terms

IDOC Type - defines the syntax of the IDOC Data. It tells


which segments are found in an IDOC and what fields the
segments are made of.
Message Type - defines the processing routines of the
IDOC, how the IDOC should be interpreted
Processing Code - is a logical name that determines the
processing routine. Processing Codes usually point to a
function module but this can also be a workflow or event.
Partner Profile - defines the sender receiver relationship
between systems.
Partner Type - The IDOC Partners are classified
according to Logical Groups
Definition of Terms (Continued)

Logical System (LS) - The logical system is meant to be


a different computer and is used with the ALE
functionality. LS is used to define same SAP R/3 systems
or an external system.
KU Customer - Used in classical EDI transmission to
designate a partner that requires a service from your
company. (Ship to party, sold to party, Payer)
LI Supplier - Used in classical EDI transmission to
designate a partner that delivers service to your
company. (Shipping Agent)
IDoc Structure
Control Record •Stored in the table EDIDC.

•Info about outgoing and incoming IDocs


as well as their processing in the SAP
system and an external system

Stored in table EDID2 / EDID4

•has organizational info in the 1st field 


determines syntactical construction of an IDoc and
assigns the data record to an IDoc

Data Records •contains structural info about the


application data (SDATA)
•interpretation occurs field by field via the
segment(SEGNAM)

•stored in table EDIDS and uses structure


BDIDOCSTAT
•from the IDoc interface in the SAP R/3 system to
Status Records an external system

•contains info about the processing status


of IDoc
Table EDIDC
Table EDID2 and EDID4
Structure BDIDOCSTAT
IDoc Structure
Definition: IDoc Type
IDoc Type is a hierarchical, complex
data structure consisting of segments;
contains complete business document

Roots of the Customer-specific


sub-tree Segments

= IDoc Type

Basic Type + (Extension) = IDoc Type


IDOC Types
 Standard – SAP generated

 Custom – used/created when standard IDocs don’t fit


user requirements.

 Extension – used/created as an addition to a standard


IDoc type.
IDoc Type
Segment Type and Segment Name

Segments form the basic building blocks of an


IDoc type and are used to store the actual data.

A segment type is the name of a segment


and is independent of the SAP release.

The segment name is the release-


specific name of a segment.
Segment
Segment
Tools to Develop
WE30
Tool to define the
IDoc type with its segments

Tool to define the E1HDDOC


segment with its fields

WE31
Tools to Develop
WE30
Tools to Develop
WE31
Inbound Processing
Inbound IDOC processing is a process of collecting /
retrieving the data from an IDOC and using them for
other purposes (Transactions, Data Population,
Report, File creation, etc).

IDOC Data
Outbound Processing
Outbound IDOC processing is a process of sending
data (The data can be taken from database tables,
files, or IDOC data received) to another system.
END OF IDOC BASICS
Process Code, Port and Partner Profile

SAP Application

Process Partner
Port
Code Profile

System 2
e.g. EDI subsystem
Configuring Ports

Ports – fundamental requirement for


communicating using IDoc interface
Configuring Ports – Ports Type
File Interface
Transactional RFC
CPI-C
Internet
Programming Interface (PI)
XML

WE21
Configuring Ports – Ports Type
WE21
Partner Profiles
choose message to be sent
WE20
define path to be used
how inbound messages are processed
Partner Profiles
WE20
Process Codes

Process Code

Outbound Inbound System Status


Process Process Process Process
Code Code Code Code
partner profiles exception handling
Outbound Process Codes
WE41
Outbound Process Codes
WE41
Inbound Process Codes
WE41
Inbound Process Codes
WE42
System Process Codes
Status Process Codes
Inbound IDOC Configuration
 Needed Configuration:
(Pre-requisite: Basic type should already exist)
 Create new message type – WE81
 Link IDOC type to message type – WE82
 Allocate FM to LS – WE57
 Create new process code – WE42
 Configure Partner Profile – WE20
 Add Inbound Function Module in List – BD51
– Need to add this first before creation of an inbound
process code which will allow you selection of
function module to be used in WE42
Outbound IDOC Configuration

 Segments can be created and defined in WE31.


 Data can also be sent from one system to another
by the use of change pointers.
 Change Pointers for message types can be
activated in transaction BD50.
 Fields that are allowable for these message types
can be configured in transaction BD52.
 These fields should exist in SAP Standard
Transaction related to the specific message type.
IDOC Timing

IDOC Communication Timing:

 IDOC data can either be sent immediately


or scheduled depending on the need.

 Data transmission can be scheduled as a job when


it needs to be sent at specified times.
Inbound IDOC Development
Development BASICS:
1. Create a Function Module with the following attributes:
IMPORTING
INPUT_METHOD LIKE BDWFAP_PAR-INPUTMETHD
MASS_PROCESSING LIKE BDWFAP_PAR-MASS_PROC
EXPORTING
WORKFLOW_RESULT LIKE BDWFAP_PAR-RESULT
APPLICATION_VARIABLE LIKE BDWFAP_PAR-APPL_VAR
IN_UPDATE_TASK LIKE BDWFAP_PAR-UPDATETASK
CALL_TRANSACTION_DONE LIKE BDWFAP_PAR-CALLTRANS
TABLES
IDOC_CONTRL STRUCTURE EDIDC
IDOC_DATA STRUCTURE EDIDD
IDOC_STATUS STRUCTURE BDIDOCSTAT
RETURN_VARIABLES STRUCTURE BDWFRETVAR
SERIALIZATION_INFO STRUCTURE BDI_SER
EXCEPTIONS
WRONG_FUNCTION_CALLED
Inbound IDOC Development (continued)
2. Declare and clear the needed variables. (Internal tables/work
areas referenced from the IDOC segments)

3. IDOC Control validation (ex. Message type, etc.) by looping


into I_EDIDC.

4. IDoc Data retrieval - Looping at data records and retrieving the


data from the different segments. This is done by a LOOP then
CASE statement and when the case statement is satisfied the
data is moved to work areas declared similarly as the
segment.

5. Perform the needed processing


BDC session. File Creation, Table Population, and others…

Sample Program: IDOC_INPUT_DESADV


Outbound IDOC Development

Development BASICS:
1. Variable declaration and initialization (includes
declaration for the segments to be used)
2. Data Compilation via Database table access, File
extraction, etc.
3. Data processing
4. Data preparation (arranging data to be passed to
IDOC)
Outbound IDOC Development
(continued)

5. IDOC creation
a. Request for a unique IDOC number
Call Function ‘NUMBER_GET_NEXT’.
b. Create control records by populating EDIDC
c. Create IDOC data records by populating
EDID2 or EDID4 (depending on the system
used)
d. Create IDOC status
e. Post IDOC or queue IDOC (for middleware
pickups)
Call Function ‘MASTER_IDOC_DISTRIBUTE’
Running/Testing IDOCS

 Inbound IDOCs
– Via WE19
– Via BD87
 Outbound IDOCs
– Via Function Module
– Via Transaction
IDOC Status – Inbound Processing

Some IDOC statuses:


 51 – ERROR – Application not posted

 52 – Application Not Posted

 53 – Application document posted

 56 – Idoc with Errors Added

 60 – Error during syntax check of IDOC

 62 – IDOC passed to application

 64 – IDOC ready to be passed to application


Inbound Status Flow
Inbound IDoc Status Flow
74
Idoc was created by test transaction

50
Idoc added Partner profile
error

64 Syntax error
Idoc ready to be transferred to
application

Partner Profile error


Syntax error

62 60 56
Error during syntax check of
Idoc passed to application Idoc with errors added
Idoc (inbound)

Application Posting process

Successful
Posting?

Yes No

53 51
Application document Application document not
posted posted
IDOC Status – Outbound Processing

Some IDOC status:


 03 – Data Passed to Port OK

 05 – Error during Translation

 30 – IDoc ready for Dispatch


Monitoring IDocs
WE07
IDoc Statistics
WE05
IDoc Lists

WE02
IDoc Display

WE09
IDoc Search
Recap of Useful Transactions

 WE02 / WE05 / WE07 – View IDOCS


 WE19 – Test Inbound IDOC
 WE20 – Partner Profiles
 WE21 - Ports
 WE30 – Create/View IDOC Basic Type
 WE31 – Create/View Segments
 WE41 – Outbound Process Codes
 WE42 – Inbound Process Codes
 WE57 – FM to IDOC Type and Message type
Useful Transactions

 WE81 – Create/View Message types


 WE82 – Message type assignment to IDOC
types.
 BD87 – IDOC status monitoring
Monitoring IDocs
WEDI
IDoc Ticket Sample
Questions ...

You might also like