You are on page 1of 140

EXPERIENCE

TEAMWORK
JH SOFTECH
www.jhsoftech.co.nr
SAP ALE / IDOCS
5/19/2009 4:57:09 PM 5864_ER_WHITE. 2
JH SOFTECH
www.jhsoftech.co.nr
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
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
5/19/2009 4:57:09 PM 5864_ER_WHITE. 5
JH SOFTECH
www.jhsoftech.co.nr
ERP
Brief Overview of ALE
Brief Overview of ALE
Various Methods of CA
Various Methods of CA
Disadvantages
Disadvantages
Benefits
Benefits
5/19/2009 4:57:09 PM 5864_ER_WHITE. 6
JH SOFTECH
www.jhsoftech.co.nr
ERP
Brief Overview of IDOCS
Brief Overview of IDOCS
Creating New Idocs
Creating New Idocs
Summary
Summary
Configuration
Configuration
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
5/19/2009 4:57:09 PM 5864_ER_WHITE. 8
JH SOFTECH
www.jhsoftech.co.nr
ALE
Application Link Enabling
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 system
and non-R/3 systems as well as between loosely coupled R/3 Systems
5/19/2009 4:57:09 PM 5864_ER_WHITE. 10
JH SOFTECH
www.jhsoftech.co.nr
Benefits Of ALE
Communication interfaces allow connections integration with non-SAP
systems.
Distribution of applications between different releases of R/3 Systems
Any SAP system can be upgraded to a newer release without affecting the
existing functionality.
ALE has functions for monitoring messages flows and handling
communication problems. Thus provides reliable distribution.
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
5/19/2009 4:57:09 PM 5864_ER_WHITE. 12
JH SOFTECH
www.jhsoftech.co.nr
ALE- Outbound Process Architecture
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
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
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.
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 via
MASTER_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
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 using
MASTER_IDOC_DISTRIBUTE passing it master IDoc
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
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 the
new 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
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 module
asynchronously on the destination system and passes IDocs via memory
buffers
5/19/2009 4:57:09 PM 5864_ER_WHITE. 21
JH SOFTECH
www.jhsoftech.co.nr
ALE- Inbound Process Architecture
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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 23
JH SOFTECH
www.jhsoftech.co.nr
ALE- Inbound Process Architecture
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 saved
in the database
Process Idoc
immediately
Program RBDAPP01
is Executed
Read process code from the
partner profile
Process code points to the
posting module
Yes
No
Done
Posting Module creates the
application document
Process Flow for Inbound
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.
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
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 or
invokes 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 gets
status code of 53 else it gets status code 51
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.
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
5/19/2009 4:57:09 PM 5864_ER_WHITE. 30
JH SOFTECH
www.jhsoftech.co.nr
Define logical systems
5/19/2009 4:57:09 PM 5864_ER_WHITE. 31
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 32
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 33
JH SOFTECH
www.jhsoftech.co.nr
Assign Logical System Names for Clients
5/19/2009 4:57:09 PM 5864_ER_WHITE. 34
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 35
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 36
JH SOFTECH
www.jhsoftech.co.nr
Define Communication Parameters: RFC Destination
5/19/2009 4:57:09 PM 5864_ER_WHITE. 37
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 38
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 39
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 40
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 41
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 42
JH SOFTECH
www.jhsoftech.co.nr
Modeling the distribution
5/19/2009 4:57:09 PM 5864_ER_WHITE. 43
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 44
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 45
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 46
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 47
JH SOFTECH
www.jhsoftech.co.nr
Generate Partner Profiles
5/19/2009 4:57:09 PM 5864_ER_WHITE. 48
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 49
JH SOFTECH
www.jhsoftech.co.nr
20.8.26.12
5/19/2009 4:57:09 PM 5864_ER_WHITE. 50
JH SOFTECH
www.jhsoftech.co.nr
IDocs
5/19/2009 4:57:09 PM 5864_ER_WHITE. 51
JH SOFTECH
www.jhsoftech.co.nr
What is an IDOC?
IDoc stands for intermediate document. It is simply a data
container used to exchange information between any two
processes that can understand the syntax and semantics of the
data.
When we execute an outbound ALE or EDI Process, an IDOC is
created.
In an inbound ALE or EDI process, an IDOC serves as input to
create an application document.
Stored in the database.
Every IDOC has an unique number (within a client).
IDocs are based on EDI standards, ANSI X.12 and EDIFACT.
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 by
both outbound and inbound process.
IDocs can be viewed in a text editor. Data is stored in character
format instead of binary format.
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
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 the
business document to be exchanged between two systems. It
can 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.
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 data
record.
They are reusable components.
Data fields in IDocs may be of two types- positional and based
on qualifiers.
Segment Components-
Segment type- version independent name of segment.
SAP provided begin with E1 and customer defined by Z1.
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 segment
where you specify the fields that belong to the segment.
Segment Definitions can be no more than 1000 bytes. SAP
Segment Definitions start with E2 and customer segment
definitions start with Z2.After a segment is released and a new
version of SAP is installed any change to the segment
definition creates a new segment definition. The name of the
Segment Definition is 10 characters long and is automatically
assigned by the system from the name of segment type. The
last three characters represent the version of the segment.
Segment Documentation- Represents data dictionary
documentation for the fields in segments.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 57
JH SOFTECH
www.jhsoftech.co.nr
A segment definition is a version of a segment. A version
always contains all, and at least one field more, than the
previous one. There must only be one segment definition per
release. If a new segment definition is to be created, the
previous one must be released.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 58
JH SOFTECH
www.jhsoftech.co.nr
Extended IDocs
Extending Existing IDOC Type
Used in cases where some additional information is required in
addition to that supplied by the Standard IDoc Type.
In Transaction WE30 we create the IDoc as an Extension and
specify the basic type for which it is an extension.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 59
JH SOFTECH
www.jhsoftech.co.nr
IDOC RUNTIME COMPONENTS
An IDoc is an instance of an IDoc type. At runtime following
events occur.
Unique IDoc no. is allocated.
One control record is attached to the IDoc.
Segments translate into data records.
Status record are attached.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 60
JH SOFTECH
www.jhsoftech.co.nr
TYPES OF RECORDS IN IDocs
Control record
Data record
Status record
5/19/2009 4:57:09 PM 5864_ER_WHITE. 61
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 62
JH SOFTECH
www.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
5/19/2009 4:57:09 PM 5864_ER_WHITE. 63
JH SOFTECH
www.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 in
administrative section to interpret meaning of various data
values in a record.
Documentation- WE61
5/19/2009 4:57:09 PM 5864_ER_WHITE. 64
JH SOFTECH
www.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
5/19/2009 4:57:09 PM 5864_ER_WHITE. 65
JH SOFTECH
www.jhsoftech.co.nr
IDoc DEVELOPMENT
5/19/2009 4:57:09 PM 5864_ER_WHITE. 66
JH SOFTECH
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 their
programs.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 67
JH SOFTECH
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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 68
JH SOFTECH
www.jhsoftech.co.nr
Creating a Segment
Go to transaction code WE31.
Enter the name for your segment type and click on the Create
icon.
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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 69
JH SOFTECH
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 its
attributes.
Choose the appropriate values and press Enter.
The system transfers the name of the segment type to the IDOC
editor.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 70
JH SOFTECH
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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 71
JH SOFTECH
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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 72
JH SOFTECH
www.jhsoftech.co.nr
1.Create a new IDoc type or an extension
5/19/2009 4:57:09 PM 5864_ER_WHITE. 73
JH SOFTECH
www.jhsoftech.co.nr
1. Creating a new basic IDOC type
Creating a new segment type (we31)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 74
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 75
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 76
JH SOFTECH
www.jhsoftech.co.nr
Create an IDoc type (we30)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 77
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 78
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 79
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 80
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 81
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 82
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 83
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 84
JH SOFTECH
www.jhsoftech.co.nr
Release the segment type(WE31) and IDoc type (WE30)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 85
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 86
JH SOFTECH
www.jhsoftech.co.nr
2. Create a new message class (we81)Assign the
IDoc to a message class (we82)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 87
JH SOFTECH
www.jhsoftech.co.nr
2. Create a new message class (we81)Assign the IDoc to a message
class (we82)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 88
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 89
JH SOFTECH
www.jhsoftech.co.nr
WE82
5/19/2009 4:57:09 PM 5864_ER_WHITE. 90
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 91
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 92
JH SOFTECH
www.jhsoftech.co.nr
3.Create programs for new or extended IDocs
5/19/2009 4:57:09 PM 5864_ER_WHITE. 93
JH SOFTECH
www.jhsoftech.co.nr
OUTBOUND PROGRAM FOR CUSTOM BASIC IDOC TYPES
Outbound bound are also referred as IDoc generation
programs. 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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 94
JH SOFTECH
www.jhsoftech.co.nr
Brief rundown:
Outbound IDocs from Message Control.
These programs are implemented as function modules and are
specifically designed for applications that make use of message
control component to generate IDocs.The interface is preset by SAP.
This is mainly used by EDI processes for transactional data. ALE uses
the message control for distributing transactional data. Example
Purchase order.
Outbound IDocs from stand alone program
These programs are developed as stand alone programs with their
own interface. They can be implemented as reports or separate
function modules that can be called from another program. These
programs are mainly used for master data distribution in ALE.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 95
JH SOFTECH
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 for
master data distribution based on changes made to master
data. For example when material master is changed.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 96
JH SOFTECH
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 the
various segments.
Call the ALE service layer(MASTER_IDOC_DISTRIBUTE) to
create the IDoc in the database.
Commit work.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 97
JH SOFTECH
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 as
function modules and are designed to read IDoc data and
create an application document.
Advanced scenario - Function modules can be designed for
advanced scenarios like mass processing , serialization
checks, advanced workflow programming etc.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 98
JH SOFTECH
www.jhsoftech.co.nr
PROGRAM FLOW
Read control record information. Verify control information(msg
type) if message type is incorrect, raise the exception.
Read the IDoc data for the idoc.Several IDocs can be posted
together.
Parse through each data record and build internal tables as
required 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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 99
JH SOFTECH
www.jhsoftech.co.nr
4.Customize ALE/EDI interface to recognize the IDocs
and their programs
5/19/2009 4:57:09 PM 5864_ER_WHITE. 100
JH SOFTECH
www.jhsoftech.co.nr
The steps in configuring an outbound process depend on the type of program
you 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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 101
JH SOFTECH
www.jhsoftech.co.nr
Configuring the inbound process
Add the message type to the ALE distribution model in receivers
side.
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)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 102
JH SOFTECH
www.jhsoftech.co.nr
Developing and Assigning process code to the inbound
function module (WEDI)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 103
JH SOFTECH
www.jhsoftech.co.nr
Attributes of inbound function module (BD51)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 104
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 105
JH SOFTECH
www.jhsoftech.co.nr
Assignment of FM to logical message and IDoc type(WE57)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 106
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 107
JH SOFTECH
www.jhsoftech.co.nr
Inbound Process code(WE42)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 108
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 109
JH SOFTECH
www.jhsoftech.co.nr
Setting Inbound Parameters for Partner Profile (we20)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 110
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 111
JH SOFTECH
www.jhsoftech.co.nr
Triggering the outbound process
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
5/19/2009 4:57:09 PM 5864_ER_WHITE. 112
JH SOFTECH
www.jhsoftech.co.nr
Triggering the outbound process via change
pointers.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 113
JH SOFTECH
www.jhsoftech.co.nr
Change Pointers
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 the
change document header table CDHDR, and additional change pointers are
written in the BDCP table for changes relevant to ALE.
Report RBDMIDOC is executed to process change pointers and call the
function module for IDoc generation logic.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 114
JH SOFTECH
www.jhsoftech.co.nr
Triggering the outbound process via change pointers
Activating change pointers globally (BD61)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 115
JH SOFTECH
www.jhsoftech.co.nr
Activating change pointer for a message type ( BD50)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 116
JH SOFTECH
www.jhsoftech.co.nr
Specify the Fields for which Change pointers are to be written (BD52)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 117
JH SOFTECH
www.jhsoftech.co.nr
BD21 Create idoc type from change pointers
5/19/2009 4:57:09 PM 5864_ER_WHITE. 118
JH SOFTECH
www.jhsoftech.co.nr
Triggering the outbound process via stand alone
programs.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 119
JH SOFTECH
www.jhsoftech.co.nr
Triggering the outbound process via stand alone programs.
1. Standard program for master data e.g RBDSEMAT (BD10)
5/19/2009 4:57:09 PM 5864_ER_WHITE. 120
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 121
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 122
JH SOFTECH
www.jhsoftech.co.nr
Triggering the outbound process via stand alone programs.
2. Custom program for your own message type
REPORT zrep_idoc_outbound.
TABLES: z1seg_1,zvcust.
*data declaration
DATA: itab_data TYPE STANDARD TABLE OF edidd WITH HEADER
LINE,
itab_control_data TYPE STANDARD TABLE OF edidc WITH
HEADER LINE,
itab_comm_idoc TYPE STANDARD TABLE OF edidc WITH HEADER
LINE,
itab_cust TYPE STANDARD TABLE OF zvcust WITH HEADER
LINE.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 123
JH SOFTECH
www.jhsoftech.co.nr
SELECT customerid fname INTO CORRESPONDING FIELDS OF
TABLE 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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 124
JH SOFTECH
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
5/19/2009 4:57:09 PM 5864_ER_WHITE. 125
JH SOFTECH
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
5/19/2009 4:57:09 PM 5864_ER_WHITE. 126
JH SOFTECH
www.jhsoftech.co.nr
EXCEPTIONS
error_in_idoc_control = 1
error_writing_idoc_status = 2
error_in_idoc_data = 3
sending_logical_system_unknown = 4
OTHERS = 5.
COMMIT WORK.
IF sy-subrc <> 0.
WRITE sy-subrc.
ELSE. WRITE / itab_status-status.
WRITE / itab_status.
ENDIF.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 127
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 128
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 129
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 130
JH SOFTECH
www.jhsoftech.co.nr
5/19/2009 4:57:09 PM 5864_ER_WHITE. 131
JH SOFTECH
www.jhsoftech.co.nr
Inbound Processing of IDocs
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
Application Layer
5/19/2009 4:57:09 PM 5864_ER_WHITE. 132
JH SOFTECH
www.jhsoftech.co.nr
INTERFACE FOR THE FUNCTION MODULE
Importing parameters:-
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. Value
of 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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 133
JH SOFTECH
www.jhsoftech.co.nr
Call_transaction_done- specifies how status codes are updated. In
ALE 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_num
contains the Idoc no. or the document no. and the values for the
wf_param are processed_idocs, error_idocs, appl_objecs.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 134
JH SOFTECH
www.jhsoftech.co.nr
INBOUND Function Module for Customer defined programs
FUNCTION Z_IDOC_INPUT_ZGET2.
*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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 135
JH SOFTECH
www.jhsoftech.co.nr
SELECT SINGLE * FROM zvcust INTO wa_cust WHERE customerid EQ
itab_cust-customerid.
IF sy-subrc NE 0.
INSERT INTO zvcust VALUES itab_cust.
ELSE
SELECT 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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 136
JH SOFTECH
www.jhsoftech.co.nr
APPEND return_variables.
idoc_status-docnum = idoc_contrl-docnum.
idoc_status-status = '53'.
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.
5/19/2009 4:57:09 PM 5864_ER_WHITE. 137
JH SOFTECH
www.jhsoftech.co.nr
THANK YOU!
5/19/2009 4:57:09 PM 5864_ER_WHITE. 138
JH SOFTECH
www.jhsoftech.co.nr
Agenda
5/19/2009 4:57:09 PM 5864_ER_WHITE. 139
JH SOFTECH
www.jhsoftech.co.nr
Q & A
Q&A
5/19/2009 4:57:09 PM 5864_ER_WHITE. 140
JH SOFTECH
www.jhsoftech.co.nr
Thank you

You might also like