Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Company1
Company2
EDI Subsystem
Message
EDI Subsystem
Distributed applications arise due to: The globalization of markets Company-wide business processes Independent and autonomous business units
Availability requirements (7x24, Upgrade) Data protection Industry, language and country versions Time zones Communication with non-SAP systems
Distributed applications arise due to: Load distribution mySAP.com components (New Dimension Applications) Failure risks Use of existing systems
Document Exchange
Document
IDoc
EDI Subsystem
Message
EDI Subsystem
The Benefits of the EDI Process Reduced data entry errors Reduced processing cycle time Reduced paper work
Competitive advantage
SAP Application
External System
Outbound Processing Inbound
Generate IDoc
Report Status
Generate IDoc
Check MC record Read partner profile Call selection module (from application) Call ALE Services Transfer according to output mode '1'/ '2' Single IDoc '3'/ '4' Multiple IDocs via RSEOUT00
R S N A S T E D
R/3 System
IDocs in Business Processes
Control
SAP Application
Document
External System
Outbound Process
During outbound processing using Message Control, the application sends IDocs to the IDoc Interface via Message Control. The IDocs can be processed further (for example filtered) by the ALE services, if required, before being sent to the port. The IDoc Interface sends each IDoc to the subsequent system according to the technical port definition. Examples of various port types: External system = R/3 System: usually transactional RFC (standard ALE scenario)
SAP Application
Document
MC
MC record
SAP Application
Editing
Application data
Message Determination
MC record
Message proposal
Condition Elements
SAP Application
1:n
Procedure
m:n
Output Type
n:1
Access Sequence
m:n
Condition Table
SAP Application
Ma st er ID oc
External System
-Determine the IDoc recipient using a maintained distribution model, in case the application itself did not specify the recipient.
-Duplicate the IDoc, if required, for distribution models. The ALE services create one (or more) communication IDoc(s) from one master IDoc (which is transferred to function module MASTER_IDOC_DISTRIBUTE). Only communication IDocs are saved in the database.
R/3 System Check port & partner, Generate IDoc Post document
ok? No ok? No
Error handling
Documentation Documentation Tools Tools Port Port Definition, Definition, Partner Partner Profiles Profiles
External System
IDoc
IDoc
SAP Application
External System
IDoc
SAP Application
When IDocs are received, they are first saved in the database. In a second and independent step, they are processed further (for port types "file", "XML", "CPIC"). This is made possible by the workflow event concept: If IDocs are saved in the database, an event is created , which waits for the "receiver" in the system. The "receiver" (a function module) finds the event and triggers inbound processing. As a result of this step, the function module has used the event, which no longer exists in the system. The Workflow Manager determines when the receiver starts to search for events: There is therefore an interval between the data being saved and further processing being initiated (asynchronous processing).
To enable this new form of inbound processing to take place, the corresponding event must be actively linked to the receiver. You must therefore activate the event-receiver linkage in the IMG for the IDoc Interface.
Post document
ok?
No
ok?
Express Message
Error handling
No
Exception Handling
Exception handling or error handling is always defined as a workflow. One or more agents can be notified about the error situation. The agents are defined in the IDoc Interface and in the organization model of your company. SAP standard exception handling in the IDoc Interface always takes place using single-step tasks. It is identified by means of process codes. If you set the express indicator in the process codes maintenance, the agent responsible for the corresponding task receives a message on their screen as soon as a new work item appears in their integrated inbox.
in Various Formats
? ? ?
Begin End
XML
tRFC Port
Mail Attachment
Customer Development
Different kinds of conversions are possible Which one to use depends on the relationship between the partners
Without Conversion ALE Converter EDI Subsystem
EDI Subsystem
IDoc
ALE Converter
?
EDI
Converter
?
ERP System
ERP System
IDoc Concept
System 1
Document
System 2 IDoc
Document
Message-oriented Asynchronous
IDoc Applications
Business Connector Internet Intranet ALE IDoc R/3 System EDI Subsystem
R/2 System
Workflow
Electronic Form
Other Systems...
Control record
Data records
Status records
Control record
Control record
Data record
Control part, contains segment names Application data
Field 1 Field 2 ...
Segment
Status Record
Control record
Data records
Control part Application data
Status records
Each IDoc in the SAP database consists of: One control record Data records which store the application data in segments and describe the hierarchy of these segments. Status records which determine the defined processing steps for the IDoc. As a result, the number of status records for an IDoc increases as processing continues. An IDoc for transmission to or from an external system, however, only consists of: One control record
IDoc Types
E1TLSUM
C 1
E1HDADR
C 5
E1ITDOC
Elternsegment M 1
E1ITSCH E1ITSCH
C 99
Kindsegment
Status Records
IDOC TYPE
Each business process (for example a purchase order) usually corresponds to a certain IDoc type, which can include the relevant data. An IDoc type is defined by the segments, their hierarchy, sequence and frequency of use. This information is contained in the control part of the data records. The segment hierarchy can be represented in tree form as parent and child segments. This allows the application data to be structured. Summary: IDoc types are special data structures for special applications or messages. If such a structure contains application data, an IDoc is created (the instance of the IDoc type).
systems.
Known implementation areas for IDocs: ALE and
EDI scenarios
The IDoc Interface facilitates both IDoc processing
record and several data and status records.Only control records and data records are exchanged with external systems.
There are various IDoc types which are distinguished
by their segments and their order.This information is stored in the control part of the data records.
Different processing options are available for IDocs in
Customer
Sales
Segment
E1...
Field 1
Field 3
Field 4
internal external
E2...001
Field 1
Field 2
SAP AG 1999
Data Structures:
Application
Function module Program Report IDoc Type Business Workflow Function module
Inbound Processing
Segment
Outbound Processing
Segment type Segment name
IDoc Interface
Data structure
+ =
The IDoc type is a hierarchy consisting of segments and complex data structures which can receive an
There is a formal distinction between basic types and extensions. The specific document in "IDoc format" is called an IDoc and has a specific IDoc type. An extension expands a basic type (SAP standard) by a customer specific segment, which are directly or indirectly dependent of basic type segments. The segments of the basic type are represented by the roots and the sub-trees, formed by the customer segments. The control record identifies the IDoc type using the following fields: IDOCTYP Name of the basic type CIMTYP Name of extension
Examples:
IDoc type ORDERS01 from standard system, not extended: The field IDOCTYP has the value ORDERS01 The field CIMTYP is empty
Segment
Segment name /partner/ccccc000 Segment name E2ccccc013 Segment type /partner/ ccccc Segment name /partner/ccccc001
Version 14 e.g.7.7x
SAP release independent segment type At least one SAP release dependent segment name (segment definition). Segment types are structures in the dictionary. They are used as internal names in the SAP System. An external system, for example an EDI subsystem, can recognize the version of the current segment by the segment name. Segment types are a maximum of 27 digits. Segment names are derived from the segment types by adding 3 digits (starting with 000). The naming conventions are preserved through the IDoc definition tools. SAP segments differ from this rule: Segment types start with E1, segment names with E2 and additionally have a version number. The customer can also use the namespace "Z1"/ "Z2" or a customer prefix. Partners always use a prefix. All segment fields are of type CHAR. Thus all SAP data types with similar characters are permitted, for example NUMC or CLNT.
By releasing segments and IDoc types, the external interface is "frozen" and given unique names for these objects for an external partner system. There can only be one segment version for each SAP Release (for example 4.0B). The IDoc definition tools control the release.After each release, further development leads to new versions. Changes must be made in accordance with strict rules so that the interface remains compatible.
The version of an IDoc type or segment is created at a maintenance level. The last version remains the current one in all following maintenance levels. The current version is only replaced by the development of a new Global network version. of innovaion All old versions remain in the system so that it is possible to reduce the current version to an older version at any time. This enables the subsystems to be kept compatible even after an upgrade. Segment version: New fields can only be added to an existing segment. By doing this the structure of segment types gets extended. A new segment name is formed. Version of an IDoc type: You may only add new segments. A new IDoc type is created. A new version of an existing segment alone does not lead to a new version of IDoc type. Note for outbound processing: In the partner profiles the versions are listed as follows: IDoc type: By entering the IDoc type.
Segment: By entering an SAP Release. This leads to the reduction of all segments which are used in the IDoc type to an older version, that is, to the current version stated in the release. If the field remains empty, the current version of all segments relating to the current release is used. Note for inbound processing: No settings are necessary or possible. The IDoc Interface recognizes the version and processes the data accordingly.
Additional customer fields are recorded in their own customer segments. Customer segments depend on SAP segments (successor or child relationships). The processing of customer segments is exclusively implemented in the customer exits of the coding provided in the standard system.
of Customer Extension
Application
Function Module Program Report IDoc Type Business Workflow Function Module
Data structure in the WEDI area menu Outbound and inbound processing: Typically through transaction "CMOD", otherwise through individual technique Documentation: In the WEDI area menu
Segment
Segment Type
Segment Name
IDoc Interface
Combine the required fields and their data types in the dictionary. Definition of required segments, segment editor. Definition of extension, IDoc type editor. Assignment of a logical message to the IDoc type, surrounding field menu of IDoc type editor.
Definition of a project, project management, attribute Choosing the "correct" customer exits, project management, SAP extensions Implementation of the selected customer exits, project management, extension components
Outbound processing: reading of the SAP database and data in "IDoc format" Inbound processing: writing data from the "IDoc format" into the SAP database
Port Definition
Port types and when they are used Port definition parameters Communication with Older Releases
Generate IDoc
Port Definition
External System
IDoc Interface
IDoc/ status IDoc/ status
IDoc
IDoc
IDoc
IDoc
File
XML
tRFC
Internet
CPI-C
PI
External System
R/2 System
Ports are the channels via which the IDocs are exchanged. The IDoc Interface supports six
"File": IDocs are written in files at an operating system level. The receiving system can read the files here. The receiving system can also be started using the synchronous RFC. Besides IDocs (that is data and control records), status records can also be exchanged by file.
"XML": The IDocs are written in XML format in the files. As is the case with the port type "file", the receiving system is started via RFC, but here status records are only transferred by means of the IDoc type SYSTAT01.
"Transactional RFC" IDocs are sent as tables. Typically here, the external system is an R/3 System (ALE scenarios).
"CPI-C" IDocs or control records are transferred according to the CPI-C protocol, in the way it is implemented for the IDoc Interface in the R/2 System. The external system is always an R/2 System. IDocs are always exchanged by means of the CPI-C protocol in the R/2 IDoc Interface (available from R/2 Release 5.0F). For further information see the R/2 handbook, p53.2.
"Internet": The IDocs are written in MIME format to an e-mail attachment. "Programming Interface (PI)": IDocs are sent as tables to one of the function modules defined. You therefore do not leave the R/3 System via a PI port. Your function module can naturally trigger or perform an external dispatch.
rfcexec out.script
IDoc Interface
Write RFC
4
Read
IDoc file Status report
3
RFC
startrfc in.script status.script
1
IDoc file
2
rfcexec out.script
Read
Call
1
Write
2
Call
3 External System
EDI_DC40 ...
The IDoc data is written in a file under the port type "XML", but in XML format. Hence the port definition and technical structure are almost identical. Under port type "file", no structure information at all is written in the file. The individual segments are put in a row one after another as data records and are separated with carriage return. Thus you also speak of a "flat file". The fields are identified by means of their position in the individual records. Such a flat file therefore contains as many blank characters as possible so that the fields are in the right place.
EDI_DC40
E1EDP01
E1EDP20
E1EDPT1
E1EDPT2
<EDI_DC40 SEGMENT="1"><TABNAM><![CDAT A[EDI_DC40]]></TABNAM><MANDT>004</MAN DT><DOCNUM>0000000000307023</DOCNUM> ... <E1EDP01 SEGMENT="1"><POSEX>00010 </POS EX><ACTION>001</ACTION><PSTYP>0</PSTYP ><MENGE>23.000</MENGE>... ... <E1EDP20 SEGMENT="1"><WMENG>23.000 </W MENG><EDATU>19990622</EDATU></E1EDP2> ... <E1EDPT1 SEGMENT="1"><TDID>BEST</TDID> <TSSPRAS>D</TSSPRAS>... ... ... <E1EDPT2 SEGMENT="1"><TDLINE>This is the purchase order text.</TDLINE>... ... </E1EDPT1> </E1EDP01>
The segments are also written one after another in the XML file. But they are considerably different to a flat file: Segments are enclosed by start and end tags and therefore do not need to be separated by carriage return. As the fields are also enclosed by tags, the segments are only ever as long as the data contained requires hence there are no "unnecessary" blank characters. As the tags can be connected with one another in XML, you can display an XML file as a tree. The SAP system IDoc structure therefore remains in the file received and can be displayed in any XML-compatible browser.
Only the name of an existing logical RFC destination is entered in the port definition. The system then generates a name for this port which consists of an "A" and a 9 digit number. The automatic number assignment requires a number range which is configured in IDoc Interface Customizing. There you can also set whether the numbers are to be assigned internally or by an external system.
Alternatively to port definition in the IDoc Interface, you can create tRFC ports from ALE Customizing.
The RFC destination itself is maintained with the transaction SM59 as the "R/3 connection".
IDoc Interface
RFC Interface
TCP/IP
RFC Interface
External System
For tRFC a system calls a function module in a second system. It follows for the IDoc data exchange that the sending system is always the active system: It calls the function module in the receiving system and transfers the IDocs as tables. The function modules are therefore inbound function modules of the respective system.
Inbound function modules in the IDoc Interface are the function modules INBOUND_IDOC_ASYNCHRONOUS (new for Release 4.0) and INBOUND_IDOC_PROCESS (older releases). Therefore if you want to send IDocs from a 4.0 System to an older R/3 release, you must call INBOUND_IDOC_PROCESS there: This is set via the port version. Non-R/3 Systems require the R/3 RFC library. The external RFC Interface can be generated for the function module from the development environment (transaction SE37) (menu: Utilities -> RFC Interface -> Generate). If a nonR/3 System wants to be able to receive IDocs by tRFC, it still needs a function module that is configured like INBOUND_IDOC_ASYNCHRONOUS or INBOUND_IDOC_PROCESS.
All IDocs transferred are saved asynchronously in the database using the single COMMIT WORK command.
Field 1
Field 3
Field 2
4.X
Field 1
Field 2
New field 3
3.0/3.1
Field 1
Field 2
2.1/2.2
The IDoc record types are defined in the dictionary by their structure.
Structures have changed in different releases, with names becoming longer and new fields being added. Example: For R/3 Release 3.0, the partner function was included in the control record. To be able to communicate with earlier releases, the version is specified in the port definition: Version 1: Record types are transferred using the Releases 2.X structure Version 2: Structure of Release 3.X Version 3: Structure of Release 4.X For port type "tRFC", a non-R/3 System must also recognize the function module to be called, as well as the correct record types: INBOUND_IDOC_ASYNCHRONOUS (new in Release 4.0) or INBOUND_IDOC_PROCESS (older releases). As record types in the R/2 System always have the same structure, no version must be maintained for port type CPI-C. The structure is covered by R/3 Release 3.0/3.1 (version 2).
R/3 System
Post document
Generate IDoc
Partner Profiles
Partner Permitted agents General Partner Message Port IDoc type EDI structure Permitted agents Outbound Processing Process code Logical message Partner Message Process code Permitted agents Inbound Processing MC parameters
Partner Application
Number and type). Additional general parameters: For example, "party to be notified" when an error occurs if no special settings have been entered (in outbound or inbound). Outbound partner profile (general): 3 keys are used - partner (3 fields: number, type, function), logical message (3 fields: (type, code, function) and the test flag. The partner refers to the general partner profile. Additional parameters: For example, the outbound port and IDoc type. This means that the values for partner, message and test flag define the port and IDoc type in a unique way. The outbound processing values must always be maintained, regardless of the type of outbound processing used (direct or using Message Control).
Additional parameters for outbound processing under Message Control (MC): This type of outbound processing (applied in MM and SD) uses the MC key (from the condition record): Application key and output type. The partner key part consists of the partner type and function and is taken from the general partner profile. You must ensure that you enter the correct partner function, that is, the one the application uses to call Message Control. Caution: The output type has nothing to do with the logical message in the IDoc interface.
Inbound partner profile: The same 7 key fields which are included in the outbound partner profile are used in this case. The partner refers to the general partner profile. Additional parameters: For example, the process code which defines the type of inbound processing (business process). Summary: Partner, message and test flag define the business process in a unique way.
Partner profiles can be checked for consistency. This function is reached via a pushbutton from the partner profile initial screen. You should ensure that both parts of the outbound partner profile are maintained: The "outbound parameter" (general) part and the "Message Control" part: If the Message Control part is missing, a warning is always displayed, even if this part is not required because the system cannot recognize whether or not this part is needed. If you do not require the Message Control part, you should simply ignore this warning message.
SAP Application
Document
Document
Receiving System
MC record
General Outbound
IDocs available in the database as a template and edit the copy. You can add or delete segments and therefore create your own IDoc type in an ad hoc manner.
Function Module
(in Dir bo ec un t d cal on l ly)
Mass test
Standard processing
Ge ne rat e fil e
Application MC
WE15
Workflow
WE19 , WE18
IDoc Interface
WE14, WE19 WE16 WE17
External System
WE12
Status confirm.
File System
WE18
Outbound Processing
Application MC MC
WE15
IDoc Interface
WE14, WE19
External System
When testing from MC (transaction WE15), you can test whether an IDoc is created correctly from a generated MC record. In this case, dispatch time 1 or 2 must be configured in the message condition record: This stops message processing, that is, the processing program RSNAST00 is not started directly when the application document is created, and the MC record is assigned the status 0 (not yet processed). Transaction WE15 does nothing but start program RSNAST00, that is, trigger further processing manually. Using this method, you can, for example, go into debugging mode or export messages, which is not possible in other cases. Both the IDoc test (transaction WE14) and the test tool (transaction WE19) test the transfer of one or more IDocs to the specified port. As a prerequisite for the IDoc test, an outbound IDoc which has not been sent to any ports must exist already (current status 30). Such an IDoc can be generated, for example, using transaction WE15: In the corresponding partner profiles, the output mode must be entered as "collect IDocs, so that the IDocs are not forwarded immediately. There are no prerequisites for the test tool.
Note: Transaction WE15 can only be used in conjunction with moving data from the applications SD and MM. The corresponding message types are ORDERS, ORDRSP, DESADV and INVOIC, for example. Only these modules and messages use Message Control for IDoc outbound processing.
Both the modified outbound file test (transaction WE12) and the original inbound file test (WE16) test the transfer of an IDoc file via the IDoc Interface. WE12 changes control records to create an inbound IDoc from an outbound IDoc, before the IDoc is sent to the IDoc Interface. There are no prerequisites for the inbound test tool: no inbound port of type "file" is needed and no files are required from the file system. The test tool can even create inbound IDocs if necessary. Check the online documentation (extended help) for the test tools. Note: WE16 erases the inbound file after the file has been read successfully. This does not apply to outbound files, which are read by WE12 and can therefore be used for further test runs.
Status Confirmation
Application Workflow
WE19 , WE18
IDoc Interface
WE16 WE17
WE12
Status confirm.
File System
WE18
You test the transfer of status confirmations in file format with "process status file" (transaction WE17). Transaction WE18 ("generate status file") does not need a file as it is self-generating. The IDoc display function can be used to check if the status records were written correctly to the relevant IDoc. Caution: As in the case of an original inbound IDoc, the status file is deleted after being read successfully. The test can therefore be carried out only once for each file. When a status record is received which indicates an error, a workflow is started: The (status) process code for this purpose in the standard system is EDIS. Other process codes for other tasks/workflow definitions for status processing can be created via Control -> Status process code and Control -> Status maintenance from the IDoc Interface initial screen. Status records must refer to outbound IDocs in the system, otherwise an error occurs in status processing. The general status confirmation for all port types and directions runs via the special IDoc type SYSTAT01, which is processed by standard task TS300000206. This status processing therefore always takes place via workflow. If an incorrect status is returned, a work item is generated. SYSTAT01 can be used with all the inbound test programs. IDocs of this type must be present in file form, except in the case of the test tool.
Data exchange with the file system:WE14 (outbound), WE16 (inbound), WE17 (status confirmation, inbound) Processing MC record:WE15 Data transfer from the IDoc Interface to additional inbound processing: WE19 Data transfer to any port:WE14