Powered By

Free XML Skins for Blogger

Powered by Blogger

Sunday, June 22, 2008

IDoc Procedures in SAP MM

What is IDOC

• IDOC = Intermediate Document

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

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

• In an inbound ALE or EDI process, an IDOC serves as input to create an application document.

• In the SAP System, IDOCs are stored in database.

• Every IDOC has an unique number(within a client).

• IDOCs are independent of the sending and receiving systems.(SAP-to-SAP as well as Non-SAP)

• IDOCs are based on EDI standards, ANSI ASC X12 and EDIFACT. In case of any conflict in data size, it adopts one with greater length

• IDOCs are independent of the direction of data exchange e.g. ORDERS01: Purchasing module : Inbound and Outbound

• IDOCs can be viewed in a text editor. Data is stored in character format instead of binary format.

IDOC Components

Basic IDOC Type (we30)

• Basic IDOC Type defines the structure and format of the business document that is to be exchanged.

• IDOC Type has a

– specific name

– list of permitted segments

– hierarchy of segments

– mandatory/optional segments

– minimum/maximum range of each segment.

Segments

• Segment defines the format and structure of a data record. Segments are reusable components.

• For each segment SAP creates

– Segment Type (version independent)

– Segment Definition (version dependent)

– Segment Documentation

• The last 3 characters is the version of the segment

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

IDOC Run-Time Components

• An IDOC is an instance of an IDOC Type

• At run time the following events occur

– A unique IDOC no. is allocated by SAP

– One control record is attached to the IDOC

– Segments translate into data records

– Status records are attached

– Syntax rules are checked.

• Each IDOC has 3 parts

– Control Record

– Data Record

– Status Record

• We02 or We05

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, sender, recipient information, channel it is using, which port it is using etc.

Data Record

• Data record contains application data like employee header info, weekly details, client details etc

• All data record data is stored in EDI_DD40 table and EDI_DD

Status Record

• Status record are attached to an IDOC at every milestone or when it encounter errors.

• All status record data is stored in EDID8 table.

Where and How IDOC is created

Where and How an IDOC is created?

• Lets take an example to understand this:

• Whenever a Purchase Order (PO) is created we want to send the IDOC to a vendor.

• The PO is sent in the form of an IDOC to the vendor (partner). That partner has to be EDI enabled in that system.. SAP should realize that it could send doc to this vendor electronically. (Creating a vendor is not sufficient). Partner Profile should be EDI enabled i.e. A partner profile should exist in the sap system.

• Quotation, RFQ, PO, SO, Invoice, delivery challan etc are some of the commonly exchanged documents through IDOCs

• We create only one profile for both inbound and outbound IDOCs.

• Partner profile should contain message type……to be able to exchange the IDOC.

• We define partner type, partner function and message type (it distinguish if an IDOC is being sent to same person in same function for different reason e.g. SO)

Process Code

Creating Outbound Process Code (WE41)

• What is Process Code?

Process of filling the IDOC with application data is done by Function Module. But, function module is not assigned to a Partner. It is encapsulated by a Process Code and this Process Code is assigned to a Partner in Partner Profile.

• Assigning Function Module to Process Code

- Go to Transaction WE41.

- Switch to “Change” Mode and click “New Entries”.

- Enter Process Code Name and assign the Function Module created.

Partner Profile

Creating Partner Profile (WE20)

• What is Partner Profile?

We must maintain the business partners with whom we communicate via IDocs, in Partner Profiles.

• Steps to create Partner Profile

- Goto Transaction WE20.

- Click on Create Button.

- Enter the Number of Vendor Created in Partner No. and ‘LI’ in Partner Type fields.

- Save the Data.

- For Outbound Partner Profile we have to create Outbound Parameters

- Specify Partner Function, Message type created, Port (create a port in WE21),Basic Type and Output Mode.

- Goto “Message Control” Tab and link the Message Type and Process Code created.

- Save.

Change Application Data to be transmitted

• Change Purchase Order Created using transaction ME22n for the Vendor to which partner profile has been created.

• Go to “Messages” , add the new “Message Type” to the list and Save the Purchase Order.

• An IDOC will be created for the purchase order and will be dispatched to PORT mentioned.

Check the status of IDOC (WE02)

• The IDOC status can be checked using transaction WE02

• If the status is ’03’, it implies that IDOC is passed to Port.

Summary: IDOC Workflow

The sequence:

1. Checks whether Partner profile exists or not

2. Whether that PP has a outbound parameter

3. Whether NEU message type is there or not (message control)

4. Checks the process code (gives the name of Function module)

5. Checks immediate transfer or batch transfer

6. Based on that it checks the receiver port

7. Then it will trigger the RFC destination

8. Then it triggers the event on subsystem/customer system

9. Transfer the IDOC to a port and transfer the Idoc in terms of file and it triggers the customer system

10. Customer knows from where it should pick up the file ….it picks up the file.

Extending an Existing IDOC Type

• Used in cases where some additional information is required in addition to that supplied by the Standard IDOC Type.

• In Transaction WE30 we create the IDOC as an Extension and specify the basic type for which it is an extension.

• We add the segments needed as children to existing ones.

• None of the Reference Segments can be deleted or changed.

Extension Child Segs

Basic Type (ORDERS01)

F1

F2

F3

F4

F5

Cannot be modified

IDOC Views

• An IDOC type can be used for more than one message type, which results in IDOCs containing more fields than required for a particular message type.

• IDOC views are used to improve performance in generating IDOCs to ensure only the relevant segments are filled with data.

• IDOC Views are important only for Outbound Processing.

IDOC Type

F1

F2

F3

F4

F5

Processing Logic

• The processing logic associated with the IDOC is the function module that is written to handle the inbound/outbound IDOC.

• Its written just like any function module but has to follow a standard interface (i.e. Import, Export, Changing & Tables) parameters and it is should be RFC enabled.

• In this function module we are effectively building up a table of type EDID4 (IDOC Data table) and change the control record.

No comments:

Archives