Академический Документы
Профессиональный Документы
Культура Документы
/ IDOCs
7/17/2006 1
Topics to cover
What is ALE?
Components of ALE.
Anatomy of an IDoc.
ALE Processing
Transactions For Monitoring and Processing IDocs.
Questions
7/17/2006 2
ALE Terminology
•ALE - Application Linking & Enabling
7/17/2006 3
ALE Objective
7/17/2006 4
ALE!! What is it ??
It is a set of
Tools,
programs and
data definitions
7/17/2006 5
What Data can be
Exchanged ?
Transaction Data
–SD, MM, FI, CO, etc.
Master Data
–Material, Customer, Vendor, etc.
Control Data
–Organizational Reference Information
•Plants, Sales Orgs, etc.
7/17/2006 6
Features –ALE / IDocs
Distributed System yet integrated with SAP R/3
Reliable communication
7/17/2006 7
ALE Scenario
Document
IDoc
SAP System R/3 SAP System R/3
IDoc IDoc
7/17/2006 8
Topics to cover
What is ALE ?
Components of ALE.
Anatomy of an IDoc.
ALE Processing
Transactions For Monitoring and Processing IDocs.
Trouble Shooting
Questions
7/17/2006 9
Components of ALE
Services:
Application Services
Distribution Services
Communication Services
Tools:
Customizing Tools
Development Tools
7/17/2006 10
Application Services
Services:
Application Services
This is where the SAP
Distribution Services
applications ( SD, FI,
Communication Services MM etc. ) generate
their data and
Tools: documents
Customizing Tools
Development Tools
7/17/2006 11
Distribution Services
Services:
Application Services Recipients
Distribution Services Formats and
Communication Services
Filters the data
Creates IDocs
Tools:
Customizing Tools ( Intermediate
Development Tools Documents
7/17/2006 12
Communication Services
Services:
Application Services
Distribution Services
Communication Services •TCP/IP
•RFC
Tools:
•tRFC
Customizing Tools
Development Tools • etc
7/17/2006 13
DevelopmentModel
Tools
Maintenance Tool.
(for configuring the flow of data
between systems )
Services: Shared Master Data(SMD)tools
Application Services
(for distributing master data )
Distribution Services Customization parameters
Communication Services
(within SAP for IDoc filtering and
conversion. )
Tools:
Customizing Tools
Development Tools
7/17/2006 14
Customizing Tools
Services:
Application Services
Distribution Services
Communication Services
Tools:
Customizing Tools
Development Tools Tools for creating
and modifying
IDocs
7/17/2006 15
In a Nut Shell
Master
Application
Application IDOC Determine
Determine Filter/Convert
Filter/Convert Comm.
Receipients
Receipients Data,
Data, Create
Create IDOC
IDOC IDOC
Carrier
Carrier
Application
Data Application
Application Filter/Convert
Filter/Convert Comm.
Functions
Functions Data
Data IDOC
7/17/2006 16
Topics to cover
What is ALE ?
Components of ALE.
Anatomy of an IDoc.
ALE Processing
Transactions For Monitoring and Processing IDocs.
Trouble Shooting
Questions
7/17/2006 17
IDoc Concept
System 1 System 2
SAP
Document
IDoc
7/17/2006 18
IDoc Structure
Control Record IDoc-ID
Sender-ID
Receiver-ID
IDoc type and logical message
External structure
7/17/2006 19
Control record
Data Record
Status Record
IDOC
“Intermediate
Document”
7/17/2006 20
Control Record
The very first record of an IDoc package is always
a control record. The
structure of this control record of the structure
EDIDC and describes the contents of the data
contained in the package. The control record goes to
table EDIDC
7/17/2006 21
Message Type
7/17/2006 22
Data Record
All records in the IDoc, which come after the
control record, are the IDoc data. They are all
structured alike, with a segment information part
and a data part, which is 1000 character in
length, filling the rest of the line. Data &
Segment info is stored in EDID4 for release 4.x
and EDID3 for release 2.x and 3.x.
7/17/2006 23
Status Record
Information about the IDoc status like:
IDoc identification number
Status number - table verified
IDoc type
Direction
Data and time stamp; Structure: EDIDS
7/17/2006 24
Status of IDOC
7/17/2006 25
Idoc Segments
TCODE:
WE31
7/17/2006 26
Idoc Types
TCODE:
WE30
7/17/2006 27
How to Attach Segments
7/17/2006 28
Message Types
WE81
WE82
7/17/2006 29
IDOC Type/ Message Type/ Processing
Function Module
Valid combination of Message type and IDOC type are stored in table
EDIMSG
Combination of message type and IDOC type determine the
processing algorithm. This is usually a function module and is set up in
table EDIFCT.
7/17/2006 30
Topics to cover
What is ALE ?
Components of ALE.
Anatomy of an IDoc.
ALE Processing.
i.Outbound Processing
ii.Inbound Processing
7/17/2006 31
Outbound Processing
7/17/2006 32
Outbound processing: direct
Application ALE layer Comm. layer
posting
Need to Customer
create IDOC? Distribution Model
asynch. RFC
Create master or
M Receiver determination
IDOC EDI
Segment filter
7/17/2006 33
Querying the Model
Application posting ALE layer Comm. layer
Comm. layer
7/17/2006 34
Handover IDoc to ALE
Application posting ALE layer Comm. layer
7/17/2006 35
Receiver determination
7/17/2006 36
Segment filter
asynch. RFC
- The filter is data-independent
or
Create master Receiver determination - IDOC segments that are not
M EDI
IDOC required canasynch. RFC
be removed
- or
The filter is message and receiver-
Segment filter
specific EDI
Field value conversion
Application
document posted Version change
simultaneously with
IDocs Dispatch
C C
Links control
Database
7/17/2006 37
Field value conversion
Need to Customer
create Distribution Model
IDOC?
asynch. RFC
- The contents of orindividual
Create Receiver
M fields can be EDI
master determination asynch. RFC
IDOC translated or
to new
Segment filter
values EDI
Field value suppressed
Application conversion - The filter is message and
document posted Version change receiver-specific
simultaneously
with IDocs Dispatc
C C
Databas Links h
e control
7/17/2006 38
Version change
Need to Customer
create Distribution Model
IDOC?
asynch. RFC
Create or
M Receiver
master - IDOCs can EDI
asynch.
be RFC to
changed
determination
IDOC Segment filter older versionsor
- Systems with EDI
different
Field value release levels can
conversion communicate without
Application additional application logic
document posted Version change
simultaneously
with IDocs Dispatc
C C
Databas Links h
e control
7/17/2006 39
Make Links
Application ALE layer Comm. layer
posting
Need to Customer
create Distribution Model
IDOC?
asynch. RFC
Create or
M Receiver
master EDI
determination
IDOC Segment filter
7/17/2006 40
Dispatch control
Need to Customer
create Distribution Model
IDOC?
asynch. RFC
Create or
M Receiver
master EDI RFC
asynch.
determination - Technicalorcomms
IDOC Segment filter
parameters
EDIare defined
Field value - EDI or aRFC (asynch.
7/17/2006 42
Outbound program development
• Program logic
– “How is the IDOC being created ?”
• Triggering
– “How is the IDOC creation kicked off ?”
7/17/2006 43
Program logic
IDOC program
• Select data from application tables
• Fill data into IDOC
• Pass IDOC to ALE layer
(Call function MASTER_IDOC_DISTRIBUTE)
• Commit Work
MASTER_IDOC_DISTRIBUTE
• Receiver determination
• Segment filtering
• Version Control
• Dispatch Control
ALE layer
7/17/2006 44
MASTER_IDOC_DISTRIBUTE
7/17/2006 45
Filling an EDIDD structure
7/17/2006 46
General Programming rules
Design Guidelines for creating IDOC data records:
7/17/2006 47
Left-justified Filling
Non-character fields:
‘Condense’ statement must be used
Check IDOC documentation to find out which fields
require a ‘condense’
All types unequal to ‘char’, ‘cuky’, ‘clnt’, ‘accp’, ‘numc’,
‘dats’, ‘tims’ or ‘unit’ require a condense
7/17/2006 48
Code Conversions
Replacing SAP codes with ISO codes
– Currency keys: ‘currency_code_sap_to_iso’
– Country keys: ‘country_code_sap_to_iso’
– Units of measure: ‘unit_of_measure_sap_to_iso’
– Shipping instructions: sap_iso_package_type_code’
7/17/2006 49
Basic Configuration
Elements
Create and allocate Logical System
Define Ranges (Idocs, Ports, etc )
Define RFC Destinations
Define Ports
Maintain Customer Model
Create Partner Profiles
7/17/2006 50
Logical System
TCODE:
BD54; Stored in
table T000
7/17/2006 51
Allocate Logical System to
the client
TCODE:
SCC4
7/17/2006 53
Maintaining RFC
Destinations
TCODE:
SM59
7/17/2006 54
Displaying and
Maintaining Ports
TCODE:
WE21
7/17/2006 55
Partner Profiles
TCODE:
WE20
7/17/2006 56
Partner Profiles-
Outbound
7/17/2006 57
Partner Profiles-Inbound
7/17/2006 58
Distribution Model
TCODE:
BD64
7/17/2006 59
Transfer of data
7/17/2006 60
Filter Objects
BD95
BD59
7/17/2006 61
Sending Master Data Idocs
Master
data ?
Change Pointer
based Program
7/17/2006 62
Sending Transactional Data
Idocs
Transaction
Data ?
Ensure trans- N
actional
See Master data
Integrity?
Output User-Exit N
Determinat N hard coded ALE
available?
ion layer
available ? Modification
y Y
7/17/2006 63
Change Pointers
Application Posting
Batch Program
• Post Application document Master data (RBDMIDOC)
• Determine IDOC module
• Create Change Document • Call IDOC module
ALE configuration
• Are changes ALE relevant ?
• ALE relevant Fields IDOC Module
•Write Change Pointers (Masteridoc_Create_
SMD_<MSGTYPE>)
ALE layer
Master_IDOC_DISTRIBUTE
7/17/2006 64
Change Pointers
BD61
BD50
7/17/2006 65
Change Pointers… Continued
BD52
BD60
7/17/2006 66
IDOC module
IDOC module has to be implemented as function module
Naming Convention: MASTERIDOC_CREATE_SMD_<msgtype>
Function module reads change pointers information to get data that
needs to go into IDOC
Function module logic:
Read change pointers
Fill IDOC structure
Call ALE layer
Update Change Pointer status
Commit Work
7/17/2006 67
ALE Configuration For
Change Pointers
• Define change pointer creation
• Define which change document fields are to be logged
7/17/2006 68
ALE For Transactional data -
--- Output Determination
NACE
7/17/2006 69
Output Determination --
Access Sequence
7/17/2006 70
Output Determination --
Output Types
7/17/2006 71
Output Types -- Details
7/17/2006 72
Output Types -- Partner
Functions
7/17/2006 73
Output Types -- Processing
Routines
7/17/2006 74
Output Types -- Procedures
7/17/2006 75
Output Types -- Procedures
Control
7/17/2006 76
Output Types -- Condition
records
7/17/2006 77
Inbound Processing
7/17/2006 78
Inbound Processing.
Comm. layer ALE layer Application
posting
C
Version change
Input
control A
A Serialization Process IDOC
Simultaneously update
IDOC's status
Post application
Database document
7/17/2006 79
Input Control
Comm. layer ALE layer Application
posting
C
-
Version change
For each message type and sender
one can define
when
asynch. RFCto process Segment filter
or(immediate/batch)
whether to call application Field value conversion
EDIdirectly or start customer
workflow
who should get work items in Input
case of error control A
- Incoming IDOC packets are passed to
application
A Serialization Process IDOC
Simultaneously update
IDOC's status
Post application
Database document
7/17/2006 80
Application Input
Comm. layer ALE layer Application
posting
C
Version change
- Input
Inbound IDOCs are passed to
the application via a control A
standardized function
A Serialization Process IDOC
interface
Simultaneously update
IDOC's status
Post application
Database document
7/17/2006 81
Serialization
Comm. layer ALE layer Application
posting
C
Version change
7/17/2006 82
FM Assignment to Message
Type and IDoc type
TCODE:
WE57
7/17/2006 83
Process Codes
WE41
WE42
7/17/2006 84
Process Codes in Inbound and Outbound
TCODE:
WE64
7/17/2006 85
FM For Inbound EDI
TCODE:
BD67
7/17/2006 86
Inbound Program
Development
ALE configuration
INBOUND_IDOC_PROCESS • Partner Profiles
IDOC • Version change • Process Code
• Function module attribute
• Segment filter • Function module registry
• Field conversion
Call function
IDOC_INPUT_<MSGTYPE>
If ERROR, trigger
Workflow Task
ALE layer
7/17/2006 87
ALE error handling
Execute Workitem
input Finished
Workitem completed
7/17/2006 88
ALE error handling
Necessary Steps:
Create new object type in Business Object Repository for IDOC;
object is child of IDOCAPPL
Create new customer task
Create event-couplings linking
Event ‘inputErrorOccured’ linked to standard task
Event ‘inputFinished’ to function module
To support mass processing:
Create new object type as child of IDOCPACKET
Maintain process code to refer the above objects and events
7/17/2006 89
Advanced Inbound Topics
• Data consistency
• Serialization
7/17/2006 90
Data Consistency
• Problem:
– Ensure transactional integrity
• Don’t process and IDOC twice
• Allow for IDOC reprocessing after rollback of
application document posting
• Solution:
– Application document must be posted in the same
LUW as the IDOC status records
– IDOC function module must not use a ‘Commit Work’
7/17/2006 91
Data Consistency
ALE Layer Application
function module
Lock IDoc(s)
Read IDoc(s)
Commit Work
7/17/2006 92
Serialization
2 2
1 !?
!?
7/17/2006 93
Serialization
Check, if IDOC has been overtaken
Use function module ‘IDOC_SERIALIZATION_CHECK’
react to overtaken IDOCs according to your needs
7/17/2006 94
Mass Processing
Processing more than one IDOC can improve
throughput:
more than one IDOC is processed per Commit Work
the function can be coded to add multiple entries to a table
with one update command (‘array insert’)
7/17/2006 95
Call Transaction
Pros:
Error reprocessing in foreground
Easy to program
Cons:
Call Transaction has significant performance overhead
Automatic Commit work, no data consistency
Recommendation:
Try to use function modules that update database directly
If you want to use ‘Call transaction’, they have been ‘ALE-
enabled’ to guarantee data concistency
7/17/2006 96
Topics to cover
What is ALE ?
Components of ALE.
Anatomy of an IDoc.
ALE Processing
Transactions For Monitoring and Processing IDocs.
Questions
7/17/2006 97
Monitoring IDocs
• The IDoc interface offers 2 different approaches for tracking of data
load and data flow:
Reports for monitoring
Workflow for notifications
• Both approaches are based on the concept of status transitions, i.e.
an IDoc changes its status from a given value to another value.
7/17/2006 98
List Of All IDocs Created. (Default,
Additional, EDI)-- WE02/ WE05
7/17/2006 99
Selection Program For
Issuing Output -- WE15
7/17/2006 100
Process All Selected IDocs.
WE14
7/17/2006 101
Test Tool For Idoc
Processing (WE19)
7/17/2006 102
Select IDocs BD87
7/17/2006 103
Idoc Search For Business
Contents (Database). WE09
7/17/2006 104
Status Conversion With Trfc
Execution. BD75
7/17/2006 105