Complete reference on SAP IDOC
Prepared and Submitted byRamesh Jakkula
81221
1
Complete reference on SAP IDOC
Complete reference on SAP IDOC
ContentsIntroduction 3Communication between SAP and Legacy system through IDOC 3Things to be achieved: 3Functional Logical Flow steps: 4a. How Output Type gets triggered 4b. How IDOC gets generated 5c. How IDOC gets read 5Brief explanation on IDOC 6Creation of Condition table: SPRO or V/60 16Creation of Access sequence: SPRO 19Creation of Output type: SPRO 22Assigning Delivery type to Output determination procedure: SPRO 26Creation of Condition records: NACE 34Creation of Logical system: SALE 37Creation of Port: WE21 39Creating a partner profile: WE20 41Outbound IDOC 42Creation of segment: we31 42Creation of IDOC type: WE30. 49Creation of Message type: WE81 56Creating link between IDOC type and Message type: WE82 58Creation of Process code: WE41 59Coding in User exits of Function Module: SE37 61Viewing IDOC in IDOC list: WE02 77Inbound IDOC 79Creation of Function module: SE37 79Assigning the characteristics for FM: BD51 85Assigning FM with IDOC type: WE57 86Creation of process code: WE42 88Creating partner profile for Inbound parameter: WE20 91Processing of Inbound IDOC manually: WE19 95Viewing processed Inbound IDOC: WE02 97
2
Complete reference on SAP IDOC
Introduction
This document is prepared to guide technical and functional flow for IDOC The scope of this document includes complete steps to create outbound & inbound IDOC in SAP R/3. The document gives detail on the functional customization required while creating outbound & inbound IDOC.
System SAP R/3 is used for the Outbound and Inbound operations. Information for Business (SAP R/3) would flow to-fro through IDOC using EDI as transmission mode.
Communication between SAP and Legacy system through IDOC
Outbound IDOC
Inbound IDOC
Outbound IDOC: When IDOC is sent from SAP to Legacy system. The data from tables of SAP will be filled into the segments of the IDOC and it is sent to the Legacy system. We will maintain Recipient information.
Inbound IDOC: When IDOC is sent from Legacy to SAP system. The Incoming IDOC is read by SAP and the data from segments of the IDOC will be updated into the tables of the SAP system. We will maintain Sender information.
Things to be achieved:
The Partner profile: Condition table, Access sequence, Requirement routine, Output determination procedures, Condition records, Application, Partner number, Partner type, Partner function, Output type, Port, Process code, Function Module and Message type.
IDOC creation: Segments, Basic type or Extension type.
Generating the Out going IDOC (Outbound).
Reading the Incoming IDOC (Inbound).
3
SAP Legacy system
Complete reference on SAP IDOC
Functional Logical Flow steps: a. How Output Type gets triggered
Since the document is made for the Business logic (Ex: Delivery), when the delivery is created or changed then output type gets triggered by the following steps.
Note: Condition type is nothing but Output type
4
Output determination procedure
Condition type
Access sequence
Condition table
Req. routine
Triggering of Output type
Condition
records
Delivery type
Creation of Delivery
Complete reference on SAP IDOC
b. How IDOC gets generated (Outbound IDOC)
c. How IDOC gets read (Inbound IDOC)
5
Triggering of Output type
Program RSNASTED (perform EDI_PROCESSING)
Process code
Functional Module (Fills the standard segments)
Table EDP12
User Exits
Filling the user defined segments or updates the standard segment data
Generating the IDOC with appropriate status
Incoming IDOC
Process code
Functional Module
Table EDP21
Filling/Updating the tables (By BAPI, BDC or LSMW)
Validates the Sender and Recipient information (Checks for partner profile)
Validates the Sender and Recipient information (Checks for partner profile)
Table TEDE1
Table TEDE2
Complete reference on SAP IDOC
When Delivery created or changed (vl01n or vl02n) then.1. Output determination procedures (NACE).2. Get the condition type. e.g.: ZDLV3. Validates Requirement routine if maintained.4. If succeed in Requirement routine then it will go ahead otherwise returns to the delivery
screen without triggering the output type.5. It will get the access sequence from condition type.6. For that access sequence it will get the Condition table 7. It checks for the existence of Condition records in the condition table.8. If succeed then the Condition type will get triggered and in turn the output type will gets
triggered. If fails then returns to the delivery screen without triggering the output type.9. Once the output type triggered then for that output type the processing routine program
will be executed e.g.: program RSNASTED and form EDI_PROCESSING. In this form it will get the Process code for the respective output type and since the Function Module is attached to the Process code, it executes the FM (IDOC_OUTPUT_DELVRY) and in turn it will executes the user exits where the code has been written to fill the IDOC according to the requirement of the project and generates the IDOC and send it outside the system with proper status.
10. In case Inbound IDOC, FM is used to read the segments and by using BAPI or BDC or LSMW data of segments will be updated into the tables and appropriate message will be updated in the IDOC status.
Brief explanation on IDOC
1. The IDOC is nothing but (I) Intermediate (DOC) Document. 2. It is a data container (ASCII file format) used to exchange the information between any two
systems.3. Each IDOC has its own unique identity number (within a client).4. IDOC’s are stored in database (table EDID4) as simple flat files with lines of text, where the lines
are structured into data fields.
Difference between Table and IDOC e.g.: Mara V/S IDOC
6
Updating the status of IDOC
Complete reference on SAP IDOC
5. IDOC’s are processed by FM which can be assigned while customization.6. It is system independent (SAP-to-SAP or Non-SAP (Legacy)).7. It can be viewed in text editor; the data stored in DIOC is in character format.8. IDOC’s are direction independent (Outbound or Inbound).9. IDOC’s consists of 3 components.
a. Control records (EDIDC).b. Data records (EDIDD).c. Status records (EDIDS).
10. The interface used can be EDI (Electronic Data Interchange) between two SAP or with any NON-SAP systems or ALE (Application link Enabling) between two SAP systems.
A. Control records (EDIDC): It is a structure and contains the administrative information as follows:
7
Complete reference on SAP IDOC
1. Direction: determines the transmission medium of IDOC whether inbound or outbound idoc.
8
Complete reference on SAP IDOC
2. Current status: A two-digit status is assigned to an IDOC to allow the processing to be monitored. Both the SAP application and the external system during status confirmation must maintain the field with the correct value. The statuses for outbound IDOC’s are between '01' and '49', while the statuses for inbound IDOC’s begin with '50'.
3. Basic type: It is the initial creation of IDOC type where everything is designed according to the standard by SAP.
4. Extension: It is the extension of Basic type where all the segments of Basic type will exists and also the additional user defines segments exists. It is defined by the customer.
5. Message type: The message type is a business function and is unique identifier of business process where IDOC type is being used. The three field’s message type (required), message code (optional) and message function (optional) belong to the key fields in the partner profiles, which are used to determine inbound processing.
6. Partner no.: It is a number which uniquely identifies a vendor, customer or a logical system.It is the partner with whom the system will communicate.
7. Partner Type: It characterizes the communication partner. Partner type and partner number identify the partner uniquely.
9
Complete reference on SAP IDOC
8. Port: It is the point where the IDOC‘s are accepted from other system and sent to other system.
B. Data records (EDIDD): It carries application dependent data for e.g. Delivery related data The IDOC types can be a Basic type or Extension type.
1. IDOC type: The IDOC type is systematic arrangement of segment in parent and child relation (Header and Item level). It can be Basic type or Extension type. The length of each segment will be of 1000 character long.
2. Basic type: Defined by the SAP
10
Complete reference on SAP IDOC
3. Extension type: It is basically defined by the user, it is the extension of basic type for e.g.: ZFPOGSAP.
11
Complete reference on SAP IDOC
The structure of segment is similar to a table
The segment can be assigned as header level segment (single record):
12
Complete reference on SAP IDOC
The segment can be assigned as Item level segment (many records):
13
Complete reference on SAP IDOC
C. Status record (EDIDS):
14
Complete reference on SAP IDOC
15
Complete reference on SAP IDOC
Creation of Condition table: SPRO or V/60
Condition table: A table where the key fields are data combinations for which messages are triggered (and offered for processing). For each data combination, there is a condition record in the table. The data part contains the actual message. The condition tables which are contained in the standard SAP R/3 System should remain unchanged. If you want to make changes, you should create new condition tables. To do this, copy a similar, already existing condition table and make the necessary changes.
To create a new condition table: Enter the name between 501 and 999 with proper description and then select the desired fields for the condition table from the list of allowed fields. Generate the new condition table. Specify the condition tables in the access sequences. This way, you establish the link between output condition, access sequence and output condition record.
Enter table as 950 and go to menu condition -> create.
Press enter.
16
Complete reference on SAP IDOC
Select the required fields by double clicking on the field
17
Complete reference on SAP IDOC
Now click on generate (Shift+F4)
Click on Yes and save in same package and project. The Table B950 will be created.
18
Complete reference on SAP IDOC
Creation of Access sequence: SPRO (NACE)
The access sequence defines the order in which the system searches for condition records valid for a condition type. In case of EDI search is made to determine the valid default values for the respective message. To create a new access sequence, copy a similar one already existing in the system and change it to correspond to your requirements. The access sequence should be four-digit alphanumeric start with the letter Z (since SAP reserves this letter for the standard system) with appropriate description. Provide the condition table and requirement routine number.The Tables: T682, T682T and T682I
Click on Maintain Access sequences.
19
Complete reference on SAP IDOC
Press enter.
Now click on new entries and enter the following.
Save in same package and project.Now double click on Accesses at left.
20
Complete reference on SAP IDOC
Click on new entries and enter the following.
There can be multiple Condition tables per access sequence.Here you can add requirement depending upon the requirement of the project. Save it.Double click on Fields by selecting the entire row.
21
Complete reference on SAP IDOC
Creation of Output type: SPRO (NACE) The output type represents different output, such as quotations, order confirmations, and delivery notes in the SAP System. To create a new output type, copy a similar access sequence in the system and make the necessary changes the key should begin with the letter Y or Z up to 4 characters, with appropriate description. Here we have to attach a program in change output tab. It is used to control output type on change of some key fields of application data.Tables: T685, T685B, T685T, TNAPR, T681A and T681B.
Click on Maintain Output type.
Click on Edit and then on new entries and enter the following.
22
Complete reference on SAP IDOC
Enter the following
Click on tab Default values.
23
Complete reference on SAP IDOC
Enter the following.
Now double click on processing routines at left.
Click on new entries
24
Complete reference on SAP IDOC
Enter the following.
Now double click on Partner functions.
25
Complete reference on SAP IDOC
Click on new entries and enter the following
Now save in the same package and project.
Assigning Delivery type to Output determination procedure: SPRO (NACE) It is the collection of Condition types. Tables: T683, T683U, T683S and T683T.
26
Complete reference on SAP IDOC
Click on Assign Output determination procedure.
Choose the first line.
Since we are going to work only the delivery type LF, the out.pro. is V10000.Now go back and click Maintain Output determination procedure.
27
Complete reference on SAP IDOC
Select V10000 and double click on Control data.
Click on new entries and enter the following.
If needed requirement routine then maintain it.Save it in the same package and project.
Creation of Requirement routine: SPROIf the requirement is fulfilled (SY-SUBRC = 0), then it will go for further processing otherwise it will stop and no output type gets triggered.
28
Complete reference on SAP IDOC
Tables: TFRM.
Click on Define requirements.
29
Complete reference on SAP IDOC
Enter the following at the end to add new record
30
Complete reference on SAP IDOC
Save it in the same package and project.Now select the record and click on Source text (F5)
31
Complete reference on SAP IDOC
Save it in the same package and project.Now click on insert
Now code as below
32
Complete reference on SAP IDOC
In this case picking status will be C if it is completely picked. If picking status will be C then sy-subrc = 0 then condition record will be executed and if satisfied then condition type will be triggered and in turn output type will be triggered. If sy-subrc = 4 then no condition record will be executed and no output type triggered.
33
Complete reference on SAP IDOC
Creation of Condition records: NACE Tables: B950
Select V2 and click on Condition records.
34
Complete reference on SAP IDOC
Select ZDLV and double click.
35
Complete reference on SAP IDOC
Enter the following
Press F8
Enter the following and save it.
36
Complete reference on SAP IDOC
Creation of Logical system: SALE Tables: TBDLS and TBDLST.
Click on Define Logical system
37
Complete reference on SAP IDOC
Click on new entries and enter the following and save it.
38
Complete reference on SAP IDOC
Creation of Port: WE21Tables: EDIPORT and EDIPOX.
Select a port
Click on create (F7) and enter the following
Save it in same package and project.
39
Complete reference on SAP IDOC
Now click on tab Outbound: Trigger and enter the following
40
Complete reference on SAP IDOC
Creating a partner profile: WE20Tables: EDPP1, EDP13, EDP21, EDIMSG and EDP12.
Click on create (F5) and enter the following.
Click on Save.
41
Complete reference on SAP IDOC
Outbound IDOC Creation of segment: we31
42
Complete reference on SAP IDOC
Enter the segment name: ZDLVRY
43
Complete reference on SAP IDOC
Now click on Create (F5).
44
Complete reference on SAP IDOC
Now enter description and field names as below.
45
Complete reference on SAP IDOC
Click on Save
46
Complete reference on SAP IDOC
Save in proper package and project.Click on back.
47
Complete reference on SAP IDOC
Now go to menu Edit -> Set release.By this the segment is released and can be used in IDOC type. Tables: ZDLVRY
48
Complete reference on SAP IDOC
Creation of IDOC type: WE30. Tables: EDBAS and EDCIM.
Enter the name as ZDLVRY_TYPE and click on option button Extension
49
Complete reference on SAP IDOC
Click on New
50
Complete reference on SAP IDOC
Enter basic type and description.
51
Complete reference on SAP IDOC
Press Enter.
Click on + E1EDL20.
52
Complete reference on SAP IDOC
Now place the cursor at E1EDL22 and Click on Create segment (shift+F6).
Press enter
Enter the following.
53
Complete reference on SAP IDOC
Press enter.
Save in same package and project and click on back.
54
Complete reference on SAP IDOC
Now go to menu Edit -> Set release.
Click Yes.Now IDOC type can be used for the development.
55
Complete reference on SAP IDOC
Creation of Message type: WE81 Tables: EDMSG.
You can create new or utilize the standard message types.For creation of new message click on Edit button.
Press enter
56
Complete reference on SAP IDOC
Click on New Entries and enter the following
Save it in same package and project.
57
Complete reference on SAP IDOC
Creating link between IDOC type and Message type: WE82 Tables: EDIMSG
Click on Edit and then click on new entries and enter the following and save it.
58
Complete reference on SAP IDOC
Creation of Process code: WE41Tables: TEDE1 and TMSG1.
Click on Edit and then click on new entries
Enter the following.
59
Complete reference on SAP IDOC
Double click on Logical messages at left.
Click on new entries and enter the following
60
Complete reference on SAP IDOC
Save in same package and project.
Coding in User exits of Function Module: SE37 Note: We can create Z Function module to fill the segments of IDOC and to generate the IDOC.
Click on Display
61
Complete reference on SAP IDOC
Double click on perform customer_function_002
62
Complete reference on SAP IDOC
Double click on ‘002’
63
Complete reference on SAP IDOC
Now double click on zxtrk02.
64
Complete reference on SAP IDOC
Now code here as given below.
65
Complete reference on SAP IDOC
66
Complete reference on SAP IDOC
Creating a partner profile for Outbound parameter: WE20Tables: EDPP1, EDP13, EDP21, EDIMSG and EDP12.
Now click on create outbound parameter at right.
67
Complete reference on SAP IDOC
Enter the following
68
Complete reference on SAP IDOC
Click on tab Message control.
69
Complete reference on SAP IDOC
Click on + at down and enter the following.
70
Complete reference on SAP IDOC
Save it and you will be able to see as below in partner profile.
71
Complete reference on SAP IDOC
Creating/Changing Delivery: VL01n/VL02n
Press enter
72
Complete reference on SAP IDOC
Now go back and Click on Header and select the tab Administration
73
Complete reference on SAP IDOC
Change Delivery block as 03
Click on tab Shipment.
74
Complete reference on SAP IDOC
Now change the route as ZCN001
75
Complete reference on SAP IDOC
Now go to menu Extras -> Delivery Output -> Header
The output has been triggered.Now click on Save.
76
Complete reference on SAP IDOC
Viewing IDOC in IDOC list: WE02 Tables: EDID4.
77
Complete reference on SAP IDOC
78
Complete reference on SAP IDOC
Inbound IDOC
Creation of Function module: SE37
Creation of Function group
79
Complete reference on SAP IDOC
Click on Create group.
Enter the group name description and save it.
Enter the name as follows
80
Complete reference on SAP IDOC
Click on Create
Enter the following
81
Complete reference on SAP IDOC
Now enter the following
82
Complete reference on SAP IDOC
Note: The import, Export and Tables has to be maintained as it is according to the standard otherwise it will through Dump (Error).
83
Complete reference on SAP IDOC
84
Complete reference on SAP IDOC
Assigning the characteristics for FM: BD51
85
Complete reference on SAP IDOC
Click on new entries and enter as follows and save it.
Assigning FM with IDOC type: WE57 Tables: EDIFCT, EDMSG.
Click on Edit and then click on new entries
86
Complete reference on SAP IDOC
Now enter the following
87
Complete reference on SAP IDOC
Save it in proper project.
Creation of process code: WE42 Tables: TEDE2, EDMSG and TMSG2.
Click on edit and then click on new entries
88
Complete reference on SAP IDOC
Enter the following.
Save it.Now double on Logical Messages.
89
Complete reference on SAP IDOC
Click on new entries
Enter the following
Save it in proper project.
90
Complete reference on SAP IDOC
Creating partner profile for Inbound parameter: WE20
Click on + of inbound parameter at right.
91
Complete reference on SAP IDOC
Enter the following
92
Complete reference on SAP IDOC
Save it.
93
Complete reference on SAP IDOC
94
Complete reference on SAP IDOC
Processing of Inbound IDOC manually: WE19
Click on Standard Inbound
95
Complete reference on SAP IDOC
You can also process by clicking on inbound function module
Enter the following
96
Complete reference on SAP IDOC
Press enter and the inbound IDOC will be processed and a new IDOC will be saved with different number as follows.
Viewing processed Inbound IDOC: WE02 Tables: EDID4.
97
Complete reference on SAP IDOC
98
Complete reference on SAP IDOC
99
Complete reference on SAP IDOC
100