8/8/2019 Sap Ale Idocs
1/140
EXPERIENCE
TEAMWORK
JH SOFTECHwww.jhsoftech.co.nr
SAP ALE / IDOCS
8/8/2019 Sap Ale Idocs
2/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 2
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
3/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 3
JH SOFTECH
www.jhsoftech.co.nr
1
2
3
4
INTRODUCTION
ALE
IDOCS
Agenda
CONFIGURATION
8/8/2019 Sap Ale Idocs
4/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 4
JH SOFTECH
www.jhsoftech.co.nr
5
6
7
8
9
Inbound system
Analysis
Agenda
Design
Conclusion
References
8/8/2019 Sap Ale Idocs
5/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 5
JH SOFTECH
www.jhsoftech.co.nr
ERP
Brief Overview of ALEBrief Overview of ALE
Various Methods of CAVarious Methods of CA
DisadvantagesDisadvantages
BenefitsBenefits
8/8/2019 Sap Ale Idocs
6/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 6
JH SOFTECH
www.jhsoftech.co.nr
ERP
Brief Overview of IDOCSBrief Overview of IDOCS
Creating New IdocsCreating New Idocs
SummarySummary
ConfigurationConfiguration
8/8/2019 Sap Ale Idocs
7/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 7
JH SOFTECH
www.jhsoftech.co.nr
Overview of ALE
Abbreviation
Evolution
What is ALE?
Benefits
Disadvantages
8/8/2019 Sap Ale Idocs
8/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 8
JH SOFTECH
www.jhsoftech.co.nr
ALE
Application Link Enabling
8/8/2019 Sap Ale Idocs
9/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 9
JH SOFTECH
www.jhsoftech.co.nr
What is ALE ?
ALE is SAPs technology to support distributed yet integrated processes
across several SAP sytem Middleware tool in SAPs Buisness Framework Architecture
ALE can integrate business processes and functions between R/3 systemand non-R/3 systems as well as between loosely coupled R/3 Systems
8/8/2019 Sap Ale Idocs
10/140
8/8/2019 Sap Ale Idocs
11/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 11
JH SOFTECH
www.jhsoftech.co.nr
ALE Consists of
Outbound Process
Inbound Process
Exception Handling
8/8/2019 Sap Ale Idocs
12/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 12
JH SOFTECH
www.jhsoftech.co.nr
ALE- Outbound Process Architecture
8/8/2019 Sap Ale Idocs
13/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 13
JH SOFTECH
www.jhsoftech.co.nr
Some Concepts used in outbound inbound
Message Control Is an cross application technique used in pricing, account determination, and output determination. The output
determination technique triggers ALE and outputs for a business document
Change Pointers Based on change document technique
Changes made are recorded in change document header table CDHDR
8/8/2019 Sap Ale Idocs
14/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 14
JH SOFTECH
www.jhsoftech.co.nr
Concepts Contd...
Selection Programs
These are typically implemented as functional modules . Extracts Application data and creates a mater IDoc.
A selection program exists for each message type.
Filter Objects They remove unwanted data for each recipient of data
Port Definition They are used in an outbound process to define the medium in which documents are transferred
ALE uses tRFC port, which transfers data in memory to buffer
RFC Destination It is the logical name used to define the characteristics of a communication link to a remote system on functions needs to
executed
In ALE it specifies information required to log on to the remote SAP system to which IDoc is sent
8/8/2019 Sap Ale Idocs
15/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 15
JH SOFTECH
www.jhsoftech.co.nr
Concepts Contd..
Partner Profile
It specifies logical names, IDoc type, message type, tRFC port
Packet size for an IDoc
Mode in which process sends an IDoc (batch versus immediate)
Person to be notified in case of errors.
8/8/2019 Sap Ale Idocs
16/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 16
JH SOFTECH
www.jhsoftech.co.nr
Process Flow for distributing Master Data:
The Technical flow an outbound process for Masterdata
Begin
Objects to be distributed are
selected
Data is read from the databa
se and formatted into IDOC
format
ALE service layer is invoked viaMASTER_IDOC_DISTRIBUTE
ALE Distribution model is cons
ulted to determine recipients
Filtering conversion & Version
change are carried out for each recipient
Communcation Idocs are saved
in the database
Collect Idocs
Execute RSEOUT00
Program
Idoc Packets are stored in the
ARFC Data
Execute RSARFCEX , which calls
INBOUND_IDOC_PROCESS
on the Remote System
Successful
Done
No
No
Yes
8/8/2019 Sap Ale Idocs
17/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 17
JH SOFTECH
www.jhsoftech.co.nr
Processing in the Application Layer
The customer distribution model is consulted to make sure that a receiver
has been defined If at least one receiver exists, then IDoc selection program creates reads
data object from database and creates master IDoc
Master IDoc is stored in memory
Program then calls ALE service layer usingMASTER_IDOC_DISTRIBUTE passing it master IDoc
8/8/2019 Sap Ale Idocs
18/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 18
JH SOFTECH
www.jhsoftech.co.nr
Processing in ALE interface Layer
Receiver Determination
Receivers are determined from the customer distribution model
IDoc Filtering IDoc filter is specified in distribution model.
If data record doesnt meet filter criteria, it is dropped
Segment Filtering
A set of segment that are not required can be filtered out.
Field Conversion Values in the data records can be converted to global or to specific values for receivers
8/8/2019 Sap Ale Idocs
19/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 19
JH SOFTECH
www.jhsoftech.co.nr
Processing in ALE Interface Layer contd..
Version Change for segments
A new version of segment always contains fields from the previous version and additional fields that are added for thenew version. Seg.Release in IDoc type.
Communication IDocs are generated After all conversion and filtering operations ,communication records are generated .
One master IDoc can have multiple IDoc depending upon number of receivers
Syntax Check is performed Goes through syntax check and data integrity validation.
IDocs are dispatched to the communication layer
8/8/2019 Sap Ale Idocs
20/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 20
JH SOFTECH
www.jhsoftech.co.nr
Processing in the Communication layer
System reads the port definition specified in the partner profile which is
then used to read RFC destination RFC system contains communication settings to log on to remote system
The sending system calls INBOUND_IDOC_PROCESS moduleasynchronously on the destination system and passes IDocs via memorybuffers
8/8/2019 Sap Ale Idocs
21/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 21
JH SOFTECH
www.jhsoftech.co.nr
ALE- Inbound Process Architecture
8/8/2019 Sap Ale Idocs
22/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 22
JH SOFTECH
www.jhsoftech.co.nr
Some Concepts Used in Inbound
Posting Programs
They are implemented as function modules and they read data from IDoc and create an application data from it. A process code exists for each message type. like MATM for MATMAS
A process code is assigned to each posting program. Like MATM to IDOC_INPUT_MATMAS
Partner Profile It consists of partner number, mode in which IDocs are processed (batch versus immediate), and the person to be
notified in case of errors.
8/8/2019 Sap Ale Idocs
23/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 23
JH SOFTECH
www.jhsoftech.co.nr
ALE- Inbound Process Architecture
8/8/2019 Sap Ale Idocs
24/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 24
JH SOFTECH
www.jhsoftech.co.nr
Begin
Remote system calls IDOC_INBOUND_ASYNCHR
ONOUS and passes communication idoc to the system
User id is validated & authorizations are
checked
Data in the control record is
validated against the partner profile
ALE Services : Filtering conversion & Version
change are carried out
Application Idoc is savedin the database
Process Idoc
immediately
Program RBDAPP01
is Executed
Read process code from thepartner profile
Process code points to the
posting module
Yes
No
Done
Posting Module creates the
application document
Process Flow for Inbound
8/8/2019 Sap Ale Idocs
25/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 25
JH SOFTECH
www.jhsoftech.co.nr
Processing in the Communication Layer
The INBOUND_IDOC_PROCESS is triggered as a result of RFC from the
sending system. IDoc to be processed is passed as an input parameter.
Control is transferred to ALE/EDI layer.
8/8/2019 Sap Ale Idocs
26/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 26
JH SOFTECH
www.jhsoftech.co.nr
Processing in the ALE/EDI Interface Layer
Basic Integrity check
A basic integrity check is performed on the control record data such as direction, message type, and IDoc type.
Segment filtering and conversion Unwanted segments can be filtered out at this stage
Application IDoc is created on database and syntax check is performed
The IDoc is marked ready for dispatch
IDoc is passed to the posting program Partner Profile is read. If the value of the Processing field is set to Process Immediately, the IDoc is passed to posting
program using RBDAP001
Else it is buffered in the system until RDBAPP01 is executed explicitly
8/8/2019 Sap Ale Idocs
27/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 27
JH SOFTECH
www.jhsoftech.co.nr
Processing in the Posting Module
The processing code in the partner profile points to posting module for the
specific message in IDoc The posting module implemented as function module either calls SAP
transaction using call transaction command for posting documents orinvokes a direct input function module.
The results of execution is passed back via function modules output
parameters
If posting is successful, an application document is created and IDoc getsstatus code of 53 else it gets status code 51
8/8/2019 Sap Ale Idocs
28/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 28
JH SOFTECH
www.jhsoftech.co.nr
Exception Handling
Workflow is integrated in the outbound to handle exceptions. If an error occurs
at stage, a designated user is notified. Person to Be notified field in the Partner Profile is used to send the error
notification.
8/8/2019 Sap Ale Idocs
29/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 29
JH SOFTECH
www.jhsoftech.co.nr
ALE SETUP (SALE)
Define logical systems
Assign Logical Systems to Clients Define Communication Parameters: RFC Destination
Modeling the distribution
Generate Partner Profiles
8/8/2019 Sap Ale Idocs
30/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 30
JH SOFTECH
www.jhsoftech.co.nr
Define logical systems
8/8/2019 Sap Ale Idocs
31/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 31
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
32/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 32
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
33/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 33
JH SOFTECH
www.jhsoftech.co.nr
Assign Logical System Names for Clients
8/8/2019 Sap Ale Idocs
34/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 34
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
35/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 35
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
36/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 36
JH SOFTECH
www.jhsoftech.co.nr
Define Communication Parameters: RFC Destination
8/8/2019 Sap Ale Idocs
37/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 37
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
38/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 38
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
39/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 39
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
40/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 40
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
41/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 41
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
42/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 42
JH SOFTECH
www.jhsoftech.co.nr
Modeling the distribution
8/8/2019 Sap Ale Idocs
43/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 43
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
44/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 44
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
45/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 45
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
46/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 46
JH SOFTECH
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
47/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 47
JH SOFTECH
www.jhsoftech.co.nr
Generate Partner Profiles
JH SOFTECH
8/8/2019 Sap Ale Idocs
48/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 48
JH SOFTECH
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
49/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 49
JH SOFTECH
www.jhsoftech.co.nr
20.8.26.12
JH SOFTECH
8/8/2019 Sap Ale Idocs
50/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 50
JH SOFTECH
www.jhsoftech.co.nr
IDocs
JH SOFTECH
8/8/2019 Sap Ale Idocs
51/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 51
JH SOFTECH
www.jhsoftech.co.nr
What is an IDOC?
IDocstands for intermediate document. It is simply a datacontainer used to exchange information between any twoprocesses that can understand the syntax and semantics of thedata.
When we execute an outbound ALE or EDI Process, an IDOC iscreated.
In an inbound ALE or EDI process, an IDOC serves as input tocreate an application document.
Stored in the database.
Every IDOC has an unique number (within a client).
IDocs are based on EDI standards, ANSI X.12 and EDIFACT.
JH SOFTECH
8/8/2019 Sap Ale Idocs
52/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 52
JH SOFTECH
www.jhsoftech.co.nr
IDocs are independent of the sending and receiving systems.(SAP-to-SAP as well as Non-SAP)
Independent of direction of data exchange. i.e. can be used byboth outbound and inbound process.
IDocs can be viewed in a text editor. Data is stored in characterformat instead of binary format.
JH SOFTECH
8/8/2019 Sap Ale Idocs
53/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 53
JH SOFTECH
www.jhsoftech.co.nr
IDOC Components
There are basically two types of IDocs .
Basic IDocs
Extended IDocs
JH SOFTECH
8/8/2019 Sap Ale Idocs
54/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 54
JH SOFTECH
www.jhsoftech.co.nr
IDoc DEFINITION COMPONENTS
Basic IDOC Type (WE30)
Basic IDoc type - defines the structure and format of thebusiness document to be exchanged between two systems. Itcan either be SAP provided or customer developed.
Characteristics-
Name up to 30 characters where last two signify the version
no. List of permitted segments.
Hierarchy of segments.
Mandatory/optional segments.
Minimum/maximum range of each segment.
JH SOFTECH
8/8/2019 Sap Ale Idocs
55/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 55
JH SOFTECH
www.jhsoftech.co.nr
Segments
Segments- A segment defines format and structure of the datarecord.
They are reusable components.
Data fields in IDocs may be of two types- positional and basedon qualifiers.
Segment Components-
Segment type- version independent name of segment.SAP provided begin with E1 and customer defined by Z1.
JH SOFTECH
8/8/2019 Sap Ale Idocs
56/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 56
JH SOFTECH
www.jhsoftech.co.nr
Segment definition- version dependent.
Segment definition is version dependent definition of a segmentwhere you specify the fields that belong to the segment.Segment Definitions can be no more than 1000 bytes. SAPSegment Definitions start with E2 and customer segmentdefinitions start with Z2.After a segment is released and a new
version of SAP is installed any change to the segmentdefinition creates a new segment definition. The name of theSegment Definition is 10 characters long and is automaticallyassigned by the system from the name of segment type. Thelast three characters represent the version of the segment.
Segment Documentation- Represents data dictionarydocumentation for the fields in segments.
JH SOFTECH
8/8/2019 Sap Ale Idocs
57/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 57
J
www.jhsoftech.co.nr
A segment definition is a version of a segment. A versionalways contains all, and at least one field more, than theprevious one. There must only be one segment definition perrelease. If a new segment definition is to be created, theprevious one must be released.
JH SOFTECH
8/8/2019 Sap Ale Idocs
58/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 58
J
www.jhsoftech.co.nr
Extended IDocs
Extending Existing IDOC Type
Used in cases where some additional information is required inaddition to that supplied by the Standard IDoc Type.
In Transaction WE30 we create the IDoc as an Extension andspecify the basic type for which it is an extension.
JH SOFTECH
8/8/2019 Sap Ale Idocs
59/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 59www.jhsoftech.co.nr
IDOC RUNTIME COMPONENTS
An IDoc is an instance of an IDoc type. At runtime followingevents occur.
Unique IDoc no. is allocated.
One control record is attached to the IDoc.
Segments translate into data records.
Status record are attached.
JH SOFTECH
8/8/2019 Sap Ale Idocs
60/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 60www.jhsoftech.co.nr
TYPES OF RECORDS IN IDocs
Control record
Data record
Status record
JH SOFTECH
8/8/2019 Sap Ale Idocs
61/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 61www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
62/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 62www.jhsoftech.co.nr
CONTROL RECORD
All control information like IDoc number , sender , receiver,message type.
There is only one control record per IDoc.
Structure for control record is same for all IDoc.
It is stored in EDIDC table.
Documentation- WE61
JH SOFTECH
8/8/2019 Sap Ale Idocs
63/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 63www.jhsoftech.co.nr
DATA RECORD
They contain application data and are divided in two parts-
Administrative and Data section ( of 1000 bytes). Administrative Section consists of Idoc number, Segment Name,
Segment number, Version, Segment Hierarchy etc.
Data Section contains the data of respective segment.
Data section is mapped to a segment type as defined inadministrative section to interpret meaning of various datavalues in a record.
Documentation- WE61
JH SOFTECH
8/8/2019 Sap Ale Idocs
64/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 64www.jhsoftech.co.nr
STATUS RECORDS
Attached to the IDOC throughout the process .
Status code, date, time are assigned.Status codes :- For outbound processing - 0-49
For inbound processing - above 50
Latest status code is maintained in the control record.
List of status codes WE47
Documentation- WE61
JH SOFTECH
8/8/2019 Sap Ale Idocs
65/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 65www.jhsoftech.co.nr
IDoc DEVELOPMENT
JH SOFTECH
8/8/2019 Sap Ale Idocs
66/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 66
www.jhsoftech.co.nr
IDoc DEVELOPMENT
A steps to create a new IDoc are-1. Create a new IDoc type or an extension.
2. Assign the IDoc type to message class(we82).
3. Create programs for new or extended IDocs.
4. Customize ALE interface to recognize the IDocs and theirprograms.
JH SOFTECH
8/8/2019 Sap Ale Idocs
67/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 67
www.jhsoftech.co.nr
1. Creating a new basic IDOC type
1. Create Segment type - (WE31).
2. Create Basic IDoc type- (WE30).3. Release the segment type and basic IDoc type.
JH SOFTECH
8/8/2019 Sap Ale Idocs
68/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 68
www.jhsoftech.co.nr
Creating a Segment
Go to transaction code WE31.
Enter the name for your segment type and click on the Createicon.
Type the short text.
Enter the variable names and data elements.
Save it and go back. Go to Edit -> Set Release.
Follow steps to create more number of segments.
JH SOFTECH
8/8/2019 Sap Ale Idocs
69/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 69
www.jhsoftech.co.nr
Create IDOC Type
Go to transaction code WE30.
Enter the Object Name, select Basic type and click Create icon. Select the create new option and enter a description for your
basic IDOC type and press enter.
Select the IDOC Name and click Create icon.
The system prompts us to enter a segment type and itsattributes.
Choose the appropriate values and press Enter.
The system transfers the name of the segment type to the IDOCeditor.
JH SOFTECH
8/8/2019 Sap Ale Idocs
70/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 70
www.jhsoftech.co.nr
Create Message Type
Go to transaction code WE81.
Change the details from Display mode to Change mode. After selection, the system will give this message The table is
cross-client (see Help for further info). Press Enter
Click New Entries to create new Message Type.
Fill details. Save it and go back.
JH SOFTECH
8/8/2019 Sap Ale Idocs
71/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 71
www.jhsoftech.co.nr
Assign Message Type to IDoc Type
Go to transaction code WE82.
Change the details from Display mode to Change mode. After selection, the system will give this message The table is
cross-client (see Help for further info). Press Enter.
Click New Entries to create new Message Type.
Fill details. Save it and go back.
JH SOFTECH
8/8/2019 Sap Ale Idocs
72/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 72
www.jhsoftech.co.nr
1.Create a new IDoc type or an extension
JH SOFTECH
8/8/2019 Sap Ale Idocs
73/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 73
www.jhsoftech.co.nr
1. Creating a new basic IDOC typeCreating a new segment type (we31)
JH SOFTECH
8/8/2019 Sap Ale Idocs
74/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 74
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
75/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 75
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
76/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 76
www.jhsoftech.co.nr
Create an IDoc type (we30)
JH SOFTECH
8/8/2019 Sap Ale Idocs
77/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 77
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
78/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 78
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
79/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 79
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
80/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 80
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
81/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 81
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
82/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 82
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
83/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 83
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
84/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 84
www.jhsoftech.co.nr
Release the segment type(WE31) and IDoc type (WE30)
JH SOFTECH
8/8/2019 Sap Ale Idocs
85/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 85
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
86/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 86
www.jhsoftech.co.nr
2. Create a new message class (we81)Assign theIDoc to a message class (we82)
JH SOFTECH
2 C l ( 81)A i h ID
8/8/2019 Sap Ale Idocs
87/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 87
www.jhsoftech.co.nr
2. Create a new message class (we81)Assign the IDoc to a messageclass (we82)
JH SOFTECH
8/8/2019 Sap Ale Idocs
88/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 88
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
89/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 89
www.jhsoftech.co.nr
WE82
JH SOFTECH
8/8/2019 Sap Ale Idocs
90/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 90
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
91/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 91
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
92/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 92
www.jhsoftech.co.nr
3.Create programs for new or extended IDocs
JH SOFTECH
OUTBOUND PROGRAM FOR CUSTOM BASIC IDOC TYPES
8/8/2019 Sap Ale Idocs
93/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 93
www.jhsoftech.co.nr
OUTBOUND PROGRAM FOR CUSTOM BASIC IDOC TYPES
Outbound bound are also referred as IDoc generationprograms. Based on the triggering mechanism used for IDoc
generation there are three types: Outbound IDocs from Message Control.
Outbound IDocs from stand-alone programs.
Outbound IDocs from change pointers.
JH SOFTECH
8/8/2019 Sap Ale Idocs
94/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 94
www.jhsoftech.co.nr
Brief rundown:
Outbound IDocs from Message Control.
These programs are implemented as function modules and arespecifically designed for applications that make use of messagecontrol component to generate IDocs.The interface is preset by SAP.This is mainly used by EDI processes for transactional data. ALE usesthe message control for distributing transactional data. Example
Purchase order.Outbound IDocs from stand alone program
These programs are developed as stand alone programs with theirown interface. They can be implemented as reports or separatefunction modules that can be called from another program. Theseprograms are mainly used for master data distribution in ALE.
JH SOFTECH
8/8/2019 Sap Ale Idocs
95/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 95
www.jhsoftech.co.nr
Outbound IDocs from Change Pointers
These programs are implemented as function modules and their
interface is set by SAP. These programs are mainly used formaster data distribution based on changes made to masterdata. For example when material master is changed.
JH SOFTECH
PROGRAM FLOW FOR STAND ALONE
8/8/2019 Sap Ale Idocs
96/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 96
www.jhsoftech.co.nr
PROGRAM FLOW FOR STAND ALONE
Select application data from the database .
Populate control record information.
Populate an internal table of type EDID with data records for thevarious segments.
Call the ALE service layer(MASTER_IDOC_DISTRIBUTE) tocreate the IDoc in the database.
Commit work.
JH SOFTECH
INBOUND PROGRAM FOR CUSTOM BASIC IDOC TYPES
8/8/2019 Sap Ale Idocs
97/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 97
www.jhsoftech.co.nr
INBOUND PROGRAM FOR CUSTOM BASIC IDOC TYPES
Inbound programs are also called posting programs.
Basic scenario The ALE layer calls the posting program and
passes IDoc data to it. Posting programs are implemented asfunction modules and are designed to read IDoc data andcreate an application document.
Advanced scenario - Function modules can be designed foradvanced scenarios like mass processing , serializationchecks, advanced workflow programming etc.
JH SOFTECH
PROGRAM FLOW
8/8/2019 Sap Ale Idocs
98/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 98
www.jhsoftech.co.nr
PROGRAM FLOW
Read control record information. Verify control information(msgtype) if message type is incorrect, raise the exception.
Read the IDoc data for the idoc.Several IDocs can be postedtogether.
Parse through each data record and build internal tables asrequired by the direct posting function module.
Call the posting program and capture the results. Populate the return parameters.
If more IDocs are present go to step 2 else go to next one.
Return the function module. The results of the exceptions are
passed to the ALE layer.
JH SOFTECH
8/8/2019 Sap Ale Idocs
99/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 99
www.jhsoftech.co.nr
4.Customize ALE/EDI interface to recognize the IDocsand their programs
JH SOFTECH
8/8/2019 Sap Ale Idocs
100/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 100
www.jhsoftech.co.nr
The steps in configuring an outbound process depend on the type of programyou have developed for the outbound IDoc .
For stand alone programs we have following steps- Add the message to the ALE distribution model IN senders side. (BD64)
Create or change partner profile.
JH SOFTECH
Configuring the inbound process
8/8/2019 Sap Ale Idocs
101/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 101
www.jhsoftech.co.nr
Configuring the inbound process
Add the message type to the ALE distribution model in receiversside.
Define attributes for the inbound function module. (BD51) Allocate the function module to the logical message type.(WE57)
Create a new process code(WE42)
Create/ change a partner profile to add the message type and the
process code.(WE20)
JH SOFTECH
Developing and Assigning process code to the inboundfunction module (WEDI)
8/8/2019 Sap Ale Idocs
102/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 102
www.jhsoftech.co.nr
p g g g p( )
JH SOFTECH
Attributes of inbound function module (BD51)
8/8/2019 Sap Ale Idocs
103/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 103
www.jhsoftech.co.nr
Attributes of inbound function module (BD51)
JH SOFTECH
8/8/2019 Sap Ale Idocs
104/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 104
www.jhsoftech.co.nr
8/8/2019 Sap Ale Idocs
105/140
JH SOFTECH
8/8/2019 Sap Ale Idocs
106/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 106
www.jhsoftech.co.nr
JH SOFTECH
Inbound Process code(WE42)
8/8/2019 Sap Ale Idocs
107/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 107
www.jhsoftech.co.nr
( )
8/8/2019 Sap Ale Idocs
108/140
JH SOFTECH
Setting Inbound Parameters for Partner Profile (we20)
8/8/2019 Sap Ale Idocs
109/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 109
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
110/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 110
www.jhsoftech.co.nr
JH SOFTECH
Triggering the outbound process
8/8/2019 Sap Ale Idocs
111/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 111
www.jhsoftech.co.nr
Triggering the outbound process via change pointers.
Triggering the outbound process via stand alone programs.
1. Standard program for the master data
2. Custom program for your own message type
JH SOFTECH
8/8/2019 Sap Ale Idocs
112/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 112
www.jhsoftech.co.nr
Triggering the outbound process via changepointers.
JH SOFTECH
Change Pointers
8/8/2019 Sap Ale Idocs
113/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 113
www.jhsoftech.co.nr
Tracks changes made to key documents in SAP, such as Material master ,customer master , and sales orders.
When master data is changed , Changes made to a document are recorded in thechange document header table CDHDR, and additional change pointers arewritten in the BDCP table for changes relevant to ALE.
Report RBDMIDOC is executed to process change pointers and call thefunction module for IDoc generation logic.
JH SOFTECH
Triggering the outbound process via change pointersActivating change pointers globally (BD61)
8/8/2019 Sap Ale Idocs
114/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 114
www.jhsoftech.co.nr
JH SOFTECH
Activating change pointer for a message type ( BD50)
8/8/2019 Sap Ale Idocs
115/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 115
www.jhsoftech.co.nr
JH SOFTECH
Specify the Fields for which Change pointers are to be written (BD52)
8/8/2019 Sap Ale Idocs
116/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 116
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
117/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 117
www.jhsoftech.co.nr
BD21 Create idoc type from change pointers
8/8/2019 Sap Ale Idocs
118/140
JH SOFTECH
Triggering the outbound process via stand alone programs.1 Standard program for master data e g RBDSEMAT (BD10)
8/8/2019 Sap Ale Idocs
119/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 119
www.jhsoftech.co.nr
1. Standard program for master data e.g RBDSEMAT (BD10)
JH SOFTECH
8/8/2019 Sap Ale Idocs
120/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 120
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
121/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 121
www.jhsoftech.co.nr
JH SOFTECH
Triggering the outbound process via stand alone programs.2. Custom program for your own message type
8/8/2019 Sap Ale Idocs
122/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 122
www.jhsoftech.co.nr
REPORT zrep_idoc_outbound.
TABLES: z1seg_1,zvcust.
*data declaration
DATA: itab_data TYPE STANDARD TABLE OF edidd WITH HEADERLINE,
itab_control_data TYPE STANDARD TABLE OF edidc WITH
HEADER LINE,itab_comm_idoc TYPE STANDARD TABLE OF edidc WITH HEADERLINE,
itab_cust TYPE STANDARD TABLE OF zvcust WITH HEADERLINE.
JH SOFTECH
SELECT id f INTO CORRESPONDING FIELDS OF
8/8/2019 Sap Ale Idocs
123/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 123
www.jhsoftech.co.nr
SELECT customerid fname INTO CORRESPONDING FIELDS OFTABLE itab_cust
FROM zvcust WHERE customerid = '000000000010000'.*fill control table
itab_control_data-direct = '1'.
itab_control_data-rcvpor = 'A000000083'.
itab_control_data-rcvprn = 'REC_IDOC'.
itab_control_data-rcvprt = 'LS'.
itab_control_data-doctyp = 'ZIDOC_1'.
itab_control_data-mestyp = 'ZGET'.
APPEND itab_control_data.
JH SOFTECH
*fill d t t bl
8/8/2019 Sap Ale Idocs
124/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 124
www.jhsoftech.co.nr
*fill data table
LOOP AT itab_cust.
CLEAR itab_data.
CLEAR z1seg_1.
z1seg_1-customerid = itab_cust-customerid.
z1seg_1-fname = itab_cust-fname.
itab_data-sdata = z1seg_1.
itab_data-segnam = 'Z1SEG_1'.
APPEND itab_data.
ENDLOOP
JH SOFTECH
CALL FUNCTION 'MASTER IDOC DISTRIBUTE'
8/8/2019 Sap Ale Idocs
125/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 125
www.jhsoftech.co.nr
CALL FUNCTION 'MASTER_IDOC_DISTRIBUTE'
EXPORTING
master_idoc_control = itab_control_data
TABLES
communication_idoc_control = itab_comm_idoc
master_idoc_data = itab_data
JH SOFTECH
EXCEPTIONS
error_in_idoc_control = 1
8/8/2019 Sap Ale Idocs
126/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 126
www.jhsoftech.co.nr
_ _ _
error_writing_idoc_status = 2
error_in_idoc_data = 3sending_logical_system_unknown = 4
OTHERS = 5.
COMMIT WORK.
IF sy-subrc 0.WRITE sy-subrc.
ELSE. WRITE / itab_status-status.
WRITE / itab_status.
ENDIF.
JH SOFTECH
8/8/2019 Sap Ale Idocs
127/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 127
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
128/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 128
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
129/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 129
www.jhsoftech.co.nr
JH SOFTECH
8/8/2019 Sap Ale Idocs
130/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 130
www.jhsoftech.co.nr
JH SOFTECH
Inbound Processing of IDocs
ALE Layer
Application Layer
8/8/2019 Sap Ale Idocs
131/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 131
www.jhsoftech.co.nr
ALE Layer
Reads Idocs
Lock Idocs
Call Inbound Program
Write Status records
Commit work
Unlock Idocs
Process message Type
Call direct input function module
or call transaction
Return the results
Application
Document
JH SOFTECH
INTERFACE FOR THE FUNCTION MODULE
Importing parameters:-
8/8/2019 Sap Ale Idocs
132/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 132
www.jhsoftech.co.nr
po t g pa a ete s
Input_method- specifies the mode for call transaction method.eg
A (all screens), e(error) and space (background)Mass processing:-used for advanced workflow scenarios. Default
value is space.
Exporting parameters:-
Workflow_result:- Indicates if the posting was successful or not. Valueof 0 indicates success and 99999 indicates failure.
Aplication variable:- Used in advanced workflow scenarios.
In_update_task:-specifies how the piece of code that updates
database tables was invoked.
JH SOFTECH
Call transaction done- specifies how status codes are updated. In
8/8/2019 Sap Ale Idocs
133/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 133
www.jhsoftech.co.nr
_ _ p pALE enabled transactions the codes are updated in the program.
Tables:-IDoc_control :- Input parameter
Idoc_data_:- Input parameter
IDoc_status:- Output parameter.Contains the status records for each
idoc.Return variables:- Output parameter and is used for workflow
processing.It has two field wf_param and doc_num .Doc_numcontains the Idoc no. or the document no. and the values for thewf_param are processed_idocs, error_idocs, appl_objecs.
JH SOFTECH
INBOUND Function Module for Customer defined programs
FUNCTION Z_IDOC_INPUT_ZGET2.
*INCLUDE MBDCONWF
8/8/2019 Sap Ale Idocs
134/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 134
www.jhsoftech.co.nr
*INCLUDE MBDCONWF.
DATA: segty_data LIKE Z1SEG_1.
DATA: itab_cust LIKE zvcust OCCURS 0 WITH HEADER LINE.DATA:wa_cust LIKE zvcust OCCURS 0 WITH HEADER LINE.
LOOP AT IDOC_CONTRL.
IF IDOC_CONTRL-MESTYP NE 'ZGET'.
RAISE wrong_function_called.
ENDIF.
CLEAR: itab_cust.
REFRESH itab_cust.
LOOP AT idoc_data WHERE docnum EQ idoc_contrl-docnum.
CASE idoc_data-segnam.
WHEN 'Z1SEG_1'.
segty_data = idoc_data-sdata.MOVE-CORRESPONDING segty_data TO itab_cust.
ENDCASE.
ENDLOOP.
JH SOFTECH
SELECT SINGLE * FROM zvcust INTO wa_cust WHERE customerid EQitab_cust-customerid.
IF sy-subrc NE 0.
8/8/2019 Sap Ale Idocs
135/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 135
www.jhsoftech.co.nr
INSERT INTO zvcust VALUES itab_cust.
ELSESELECT MAX( customerid ) FROM zvcust INTO wa_cust-customerid.
itab_cust-customerid = wa_cust-customerid + 1.
INSERT INTO zvcust VALUES itab_cust.
ENDIF.IF sy-subrc EQ 0.
Workflow_result = 0.
return_variables-wf_param = 'PROCESSED IDOCS'.
return_variables-doc_number = idoc_contrl-docnum.return_variables-wf_param = 'APPL_OBJECTS'.
return_variables-doc_number = itab_cust-customerid.
JH SOFTECH
APPEND return_variables.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '53'.
idoc status-msgty = 'I'
8/8/2019 Sap Ale Idocs
136/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 136
www.jhsoftech.co.nr
idoc_status msgty = I .
idoc_status-msgid = 'ZE'.
idoc_status-msgno = '006'.
idoc_status-msgv1 = itab_cust-customerid.
idoc_status-msgv2 = itab_cust-FNAME.
APPEND idoc_status.
ENDIF.
ENDLOOP.
ENDFUNCTION.
JH SOFTECH
8/8/2019 Sap Ale Idocs
137/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 137
www.jhsoftech.co.nr
THANK YOU!
JH SOFTECH
Agenda
8/8/2019 Sap Ale Idocs
138/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 138
www.jhsoftech.co.nr
JH SOFTECH
Q & A
8/8/2019 Sap Ale Idocs
139/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 139
www.jhsoftech.co.nr
Q&A
JH SOFTECH
8/8/2019 Sap Ale Idocs
140/140
5/19/2009 4:57:09 PM 5864_ER_WHITE. 140
www.jhsoftech.co.nr
Thank you