This chapter describes how to integrate with SAP's Application Linking and Embedding (ALE) technology in the BEA eLink environment. It includes the following sections:
For information about setting up ALE processing, see the following chapters in the BEA eLink Adapter for R/3 Installation and Configuration Guide:
This section provides important conceptual information about integrating with ALE. It includes the following topics:
Usage Scenarios for ALE Integration
Common ALE integration implementations of BEA eLink Adapter for R/3 include:
Integrating R/3 and Non-R/3 Systems
Figure 3-1 shows how BEA eLink Adapter for R/3, in conjunction with BEA eLink Data Integration, can be used to integrate R/3 with non-R/3 systems:
Figure 3-1 Integrating R/3 and Non-R/3 Systems
In this scenario, these BEA components provide communication and data transformation services that enable the exchange of IDOC and non-IDOC data between R/3 and non-R/3 systems.
Communicating Among R/3 Logical Systems
Figure 3-2 shows how TUXEDO and BEA eLink Adapter for R/3 can be used to transport IDOCs among R/3 logical systems:
Figure 3-2 Communicating Among R/3 Logical Systems
In this scenario, BEA eLink Adapter for R/3 and TUXEDO provide reliable and efficient communication services that enable the transport of IDOC packets between R/3 logical systems, thereby reducing the load on SAP communication services.
Information Flow for ALE Integration
Figure 3-3 provides an overview of the information flow for the two main ALE processes, ALE Outbound and ALE Inbound:
Figure 3-3 Overview of Information Flow for ALE Processing
This section describes the following key concepts used in ALE processing:
Intermediate Documents (IDOCs)
In SAP's R/3 environment, an Intermediate Document (IDOC) is a container for distributing R/3 application data among R/3 logical systems and for exchanging R/3 application data with non-R/3 systems.
In ALE processing, an IDOC consists of two types of records:
Each IDOC is a sequential buffer that contains one control record and one or more data records, as shown in Figure 3-4:
Figure 3-4 Structure of an ALE IDOC
For inbound IDOCs, ALE Inbound validates the size and structure of control records and data records. For each IDOC, ALE Inbound also verifies that the DOCNUM data in the control record matches the DOCNUM data in associated data records.
An IDOC packet is a message that contains one or more individual IDOCs, as shown in Figure 3-5:
Figure 3-5 Types of IDOC Packets
The R/3 system separately maintains status information about the creation, receipt, and processing of IDOCs. See your SAP R/3 documentation for more information about IDOCs.
In the TUXEDO environment, IDOC packets are transmitted in FML32 messages. These field definitions are specified in the cr3.fml file, as described in FML32 Field Definitions in Introducing BEA eLink Adapter for R/3.
Transaction IDs (TIDs)
R/3 assigns a unique Transaction ID (TID) to each IDOC packet it processes. R/3 uses TIDs to manage transactional integrity:
In the TUXEDO environment, ALE Outbound and ALE Inbound monitor TIDs through the use of TID log files. See Managing Transactional Integrity for Inbound IDOCs and Managing Transactional Integrity for Outbound IDOCs for more information.
Processing Inbound IDOCs
This section describes how to process inbound IDOCS using the ALE Inbound server. It includes the following topics:
ALE Inbound must be properly configured before it can process IDOCs. See "Configuring
ALE Inbound" in Configuring ALE Integration in the BEA eLink Adapter for R/3
Installation and Configuration Guide for more information.
About the ALE Inbound Server
ALE Inbound is a TUXEDO server that submits IDOC packets to R/3. ALE Inbound receives each IDOC packet as an FML32 message buffer (forwarded from a TUXEDO queue) and it submits the IDOC packet to R/3 via tRFC. ALE Inbound uses a TID log file to track the TIDs associated with IDOC packets to guarantee delivery to R/3 once and only once. The name of the executable for ALE Inbound is cr3alein.
ALE Inbound provides two services that process inbound IDOC packets:
ALE Inbound Services (CR3_SUBMIT and CR3_IDOC_IN)
Service Name | Description |
---|---|
CR3_SUBMIT |
Receives an incoming FML32 buffer containing an IDOC packet from a TUXEDO queue, validates the IDOC packet data, obtains a TID from R/3 for the IDOC packet, binds the TID into the IDOC packet, and enqueues the IDOC message into the CR3_IDOC_IN queue. |
CR3_IDOC_IN |
Receives the IDOC packet from the CR3_IDOC_IN queue, encodes the IDOC data for R/3, and submits the IDOC packet to R/3 for processing. |
ALE Inbound uses the following FML32 field definitions in IDOC messages:
Field | Data Type | Description |
---|---|---|
CR3_IDOC |
string |
Contains an IDOC packet consisting of one or more IDOCs. |
CR3_TARGET_ID |
string |
Contains a data-dependent routing value. Required even if it contains only a dummy value. |
CR3_RFC_TID |
string |
Contains the Transaction ID (TID) for the IDOC packet. Internal Use Only. |
CR3_IDOC_CONTROL |
string |
Contains one or more control records for the IDOC packet. Internal Use Only. |
CR3_IDOC_DATA |
string |
Contains one or more data records for the IDOC packet. Internal Use Only. |
These fields are defined in the cr3.fml file, as described in FML32 Field Definitions in Introducing BEA eLink Adapter for R/3.
Information Flow for Inbound IDOCs
Figure 3-6 shows the information flow for inbound IDOCs:
Figure 3-6 Information Flow for Inbound IDOCs
The information flow for ALE Inbound proceeds in the following sequence:
ALE Inbound uses a TID log file to manage transactional integrity. See Managing Transactional Integrity for Outbound IDOCs for more information.
Splitting Inbound IDOC Packets
By default, ALE Inbound passes an IDOC message containing multiple IDOCs to R/3 in a single packet. You can configure ALE Inbound to split IDOC messages containing multiple IDOCs into individual IDOC messages, each with its own TID. For example, if an IDOC message contains six IDOCs, ALE Inbound can create six IDOC separate packets, each containing a single IDOC and associated with a unique TID. Figure 3-7 shows splitting IDOC packets and enqueueing them into the CR3_SUBMIT queue:
Figure 3-7 Splitting Inbound IDOC Packets
Splitting IDOC packets provides additional flexibility for processing inbound IDOCs. However, this configuration can also increase load on the R/3 system and reduce throughput performance. For example, an IDOC packet containing six IDOCs requires two RFC calls: one to request the TID and another to submit the IDOC packet to R/3. Six IDOC packets containing a single IDOC each, however, requires twelve separate RFC calls: six to request TIDs and six to submit each IDOC packet to R/3.
See Splitting Inbound IDOC Packets
Containing Multiple IDOCs in Configuring
ALE Integration in the BEA eLink Adapter for R/3 Installation and Configuration
Guide for instructions.
Load Balancing High Volumes of Inbound IDOCs
Multiple instances of ALE Inbound can log onto R/3 and submit inbound IDOCs
for processing. For deployments that involve high volumes of inbound IDOCs,
you can enhance system performance by balancing the load across multiple instances
of ALE Inbound. See Configuring Load
Balancing for Inbound IDOCs in Configuring
ALE Integration in the BEA eLink Adapter for R/3 Installation and Configuration
Guide for instructions.
Managing Transactional Integrity for Inbound IDOCs
ALE Inbound manages transactional integrity for inbound IDOCs to guarantee that it delivers an IDOC packet to R/3 once and only once. R/3 uses the TID to guarantee that it processes the IDOC packet exactly once. If an attempt to submit an IDOC packet to R/3 fails, ALE Inbound retries using the same TID. ALE Inbound uses a TID log file to track the transaction IDs (TIDs) that R/3 assigns to each inbound IDOC packet. See Transaction IDs (TIDs) for an introduction to TIDs.
About the TID Log File Used for Inbound IDOCs
The TID log file used with inbound IDOCs contains information about TIDs that ALE Inbound has received and processed. Each row in the TID file represents the TID for a separate IDOC packet and contains three fixed-position columns of information:
Column | Description |
---|---|
Date-Time Stamp |
Date and time at which the state of this TID was last updated in the TID log file. |
TID |
TID that R/3 assigned to the IDOC packet. |
Status |
One of the following strings:
|
The following example shows a sample TID file for ALE Inbound:
Tue Apr 27 14:27:40 1999 0A0201FD03F937262C600004 CONFIRMED
Tue Apr 27 14:29:39 1999 0A0201FD03F937262CD90007 CONFIRMED
Tue Apr 27 14:46:58 1999 0A0201FD03F9372630E8000A CONFIRMED
Tue Apr 27 15:52:30 1999 0A0201FD041637263FC60013 CONFIRMED
The CR3_ALEIN_TID_FILE environment variable specifies the location of the TID log file for ALE Inbound. See Setting Environment Variables for ALE Inbound in Configuring ALE Integration in the BEA eLink Adapter for R/3 Installation and Configuration Guide for more information.
Use the cr3tidmanager program to manage the size and number of entries kept
in TID files. See Configuring the TID
File Manager in Configuring ALE Integration
in the BEA eLink Adapter for R/3 Installation and Configuration Guide.
Processing TIDs with Inbound IDOCs
Figure 3-8 shows how ALE Inbound uses the TID log file to manage transactional integrity for inbound IDOCs:
Figure 3-8 TID Processing for ALE Inbound
The inbound IDOC process involves two transaction boundaries:
For the first transaction boundary, the information flow proceeds in the following sequence:
For the second transaction boundary, the information flow proceeds in the following sequence:
ALE Inbound uses TUXEDO's transaction management capabilities to ensure transactional integrity for inbound IDOCs. Figure 3-3 lists problems that can occur with inbound IDOCs:
Problem | Description |
---|---|
Invalid IDOC structure |
If an IDOC packet fails validation, the CR3_SUBMIT service enqueues the FML32 message into the CR3_ERROR queue and returns TPSUCCESS to TMQFORWARD. |
No CR3_TARGET_ID |
If an IDOC message contains no CR3_TARGET_ID field, the CR3_SUBMIT service enqueues the FML32 message into the CR3_ERROR queue and returns TPSUCCESS to TMQFORWARD. |
TID Not received from R/3 |
If R/3 for some reason does not return a TID, CR3_SUBMIT CR3_SUBMIT returns TPFAIL to TMQFORWARD, and TMQFORWARD rolls back the transaction. |
Send attempt to R/3 failed |
If the CR3_IDOC_IN service does not successfully send the IDOC packet to R/3 (for example, the R/3 system is down), CR3_IDOC_IN returns TPFAIL to TMQFORWARD, and TMQFORWARD rolls back the transaction. The IDOC packet remains in the CR3_IDOC_IN queue until a subsequent send attempt succeeds. |
Note:
You must write an application to explicitly dequeue and handle messages in the CR3_ERROR queue.
Processing Outbound IDOCs
This section describes how to process outbound IDOCS using the ALE Outbound client. It includes the following topics:
ALE Outbound must be properly configured before it can process outbound IDOCs.
For information about setting up ALE Outbound, see Configuring
ALE Outbound in Configuring ALE Integration
in the BEA eLink Adapter for R/3 Installation and Configuration Guide.
About the ALE Outbound Client
ALE Outbound is a TUXEDO client that receives IDOC packets from R/3 via Transactional RFC (tRFC). ALE Outbound encodes each IDOC packet into an FML32 message buffer and enqueues it into a TUXEDO queue. ALE Outbound uses a TID log file to track the IDOC packets that it processes to ensure that it enqueues an IDOC packet from R/3 once and only once. The name of the executable for ALE Outbound is cr3aleout.
ALE Outbound uses the following FML32 field definitions in IDOC messages:
Field | Data Type | Description |
---|---|---|
CR3_IDOC |
string |
Contains a string of one or more IDOCs. |
CR3_TARGET_ID |
string |
Data-dependent routing value. |
MERCATOR_FV_IN |
string |
Either Y or N. See the BEA eLink Adapter for Mercator User Guide for more information. |
Figure 3-9 illustrates the information flow for ALE Outbound:
Figure 3-9 Information Flow for Outbound IDOCs
The information flow proceeds in the following sequence:
ALE Outbound uses a TID log file to manage transactional integrity. See Managing Transactional Integrity for Outbound IDOCs for more information.
Splitting Outbound IDOC Packets Into Individual IDOCs
You can configure ALE Outbound to split IDOC packets containing multiple IDOCs into separate IDOC messages, each containing a single IDOC. By default, ALE Outbound encodes the entire IDOC packet into a single occurrence of the CR3_IDOC field in the message buffer and enqueues the entire IDOC packet into a single message. If you set the CR3_ALE_DEFAULT_IDOC_SPLIT environment variable to "Y", However, ALE Outbound will split the IDOC packet into individual IDOC packets and then enqueue all IDOC packets into a single queue. Figure 3-10 shows splitting IDOC packets and enqueueing them into a single queue:
Figure 3-10 Splitting IDOC Packets and Enqueuing to a Single Queue
See Setting Environment Variables for
ALE Outbound in Configuring ALE Integration
in the BEA eLink Adapter for R/3 Installation and Configuration Guide
for more information about setting the CR3_ALE_DEFAULT_IDOC_SPLIT environment
variable.
Enqueuing Outbound IDOCs Into Multiple Queues
ALE Outbound can be configured to use a destination map file so that it can enqueue IDOC messages into different target queues, manage data-dependent routing, and group similar IDOC messages into larger IDOC messages. ALE Outbound makes routing and grouping decisions about individual IDOCs according to two settings specified in an IDOC's control record: the logical system ID of the target R/3 system and the IDOC message type.
If a destination map file is used, ALE Outbound automatically splits IDOC packets containing multiple IDOCs into separate IDOC messages, each one containing a single IDOC, and enqueues them into target queues. Figure 3-11 shows splitting IDOC packets and enqueueing them into multiple queues (using the settings in the destination map file):
Figure 3-11 Splitting IDOC Packets and Enqueuing to Multiple Queues
To use a destination map file, you must set up the target queue spaces and
queues (including the default queue space and queue), create the destination
map file, and specify the name and location of the destination map file in the
CR3_ALEOUT_DEST_MAP_FILE environment variable. See Configuring
the Destination Map File in Configuring
ALE Integration in the BEA eLink Adapter for R/3 Installation and Configuration
Guide for more information.
About the Destination Map File
The destination map file is an ASCII text file. Each row in the file denotes a separate entry and specifies the following information:
For each outbound IDOC, ALE Outbound searches the destination map file for the target R/3 system and IDOC message type specified in an IDOC's control record. If it finds a matching entry, ALE Outbound enqueues the IDOC into the destination queue space and queue specified in the entry. ALE Outbound also processes the IDOC according to the Compress flag and the Target ID settings in the entry.
Compressing Outbound IDOCs
You use the Compress column in the destination map file to combine IDOC messages with matching logical system IDs and IDOC message types into an IDOC message containing multiple IDOCs. For each matching entry, if the Compress column is "Y", then ALE Outbound aggregates this IDOC with other matching IDOCs in a single, larger IDOC message that it then enqueues into the appropriate target queue. If the Compress column is "N", then ALE Outbound enqueues each IDOC message separately.
Setting the Data-Dependent Routing Value
You use the TargetId column in the destination map file to associate an IDOC with a data-dependent routing (DDR) value. For each matching entry, ALE Outbound encodes the specified TargetId value in the CR3_TARGET_ID FML32 field of the IDOC message. If this DDR is unspecified, or if no matching entry is found in the destination map file, then ALE Outbound encodes the default DDR value, which is defined in the CR3_ALE_DEFAULT_TARGET_ID environment variable.
Note: To use DDR, the DDR value must match the field ID configured in the ROUTING section of the cr3.ubb configuration file.
See Setting the Data-Dependent Routing
Value in Configuring ALE Integration
in the BEA eLink Adapter for R/3 Installation and Configuration Guide
for more information. See your TUXEDO documentation for more information about
data-dependent routing.
The first example shows how ALE Outbound processes an IDOC packet that contains a single IDOC. Suppose the destination map file contains the following entry:
Examples of Using a Destination Map File
LogicalId | MsgType | Compress | TargetId | QueueSpace | QueueName |
---|---|---|---|---|---|
LOGSYS1 |
MATMAS |
Y |
DDR1 |
QS1 |
Q1 |
Suppose also that the control record in an outbound IDOC specifies a target logical ID of "LOGSYS" and a message type of "MATMAS". Figure 3-12 shows how ALE Outbound would process this IDOC packet according to the settings in the destination map file:
Figure 3-12 Enqueuing a Single IDOC According to the Destination Map File
In this scenario, ALE Outbound finds the matching entry in the destination map file and sends the IDOC message to the Q1 queue in queue space QS1. ALE Outbound encodes the specified TargetId value ("DDR1") in the CR3_TARGET_ID FML32 field. Compression does not apply in this case because the IDOC packet contained only one IDOC.
The second example shows how ALE Outbound processes an IDOC packet that contains multiple IDOCs. Suppose the destination map file contains the following entries:
LogicalId | MsgType | Compress | TargetId | QueueSpace | QueueName |
---|---|---|---|---|---|
LOGSYS1 |
MATMAS |
Y |
DDR1 |
QS1 |
Q1 |
LOGSYS2 |
MATMAS |
Y |
DDR2 |
QS1 |
Q2 |
LOGSYS3 |
DEBMAS |
N |
DDR3 |
QS2 |
Q3 |
LOGSYS4 |
CREMAS |
Y |
DDR4 |
QS3 |
Q4 |
Suppose also that an outbound IDOC packet contains six IDOCs with the following settings in the control record of each IDOC:
IDOC | LogicalId | MsgType |
---|---|---|
IDOC1 |
LOGSYS1 |
CREMAS |
IDOC2 |
LOGSYS1 |
MATMAS |
IDOC3 |
LOGSYS3 |
MATMAS |
IDOC4 |
LOGSYS2 |
MATMAS |
IDOC5 |
LOGSYS1 |
MATMAS |
IDOC6 |
LOGSYS3 |
DEBMAS |
Figure 3-13 shows how ALE Outbound would process this IDOC packet according to the settings in the destination map file:
Figure 3-13 Enqueuing Multiple IDOCs According to the Destination Map File
ALE Outbound splits the IDOC packet into individual IDOCs and enqueues each IDOC in the following manner:
Managing Data-Depending Routing (DDR)
You can configure the default data-dependent routing (DDR) value that ALE Outbound assigns to each IDOC message (in the CR3_TARGET_ID field) that it enqueues. The behavior of ALE Outbound depends on whether a DDR value is defined in the destination map file:
See Setting the Default Data-Dependent
Routing Value and Setting Data-Dependent
Routing Values in the Map File in Configuring
ALE Integration in the BEA eLink Adapter for R/3 Installation and Configuration
Guide for instructions. See your TUXEDO documentation for more information
about data-dependent routing.
Load Balancing High Volumes of Outbound IDOCs
Multiple instances of ALE Outbound can register using the same program ID. For deployments that involve high volumes of IDOC packets, you can enhance system performance by balancing the load across multiple instances of ALE Outbound. Instances that register under the same program ID must also share the same TID file. Figure 3-14 shows multiple instances of ALE Outbound listening for IDOCs on the same program ID and sharing the same TID file:
Figure 3-14 Multiple Instances of ALE Outbound Sharing the Same Program ID
The number of ALE Outbound instances should match the anticipated number of IDOC packets that R/3 sends concurrently to port. For example, if R/3 sends five IDOC packets concurrently to port during peak loads, you should load five instances of ALE Outbound.
See Configuring Load Balancing
in Configuring ALE Integration in the BEA
eLink Adapter for R/3 Installation and Configuration Guide.
Registering Multiple Program IDs
If R/3 is configured to send outbound IDOCs to different program IDs, you can configure ALE Outbound to handle these IDOCs by running multiple instances of ALE Outbound using different program IDs. You must make sure that all instances sharing the same program ID also share the same TID file, and that all instances sharing the same TID file also share the same program ID. Instances that register under different program IDs must not share the same TID file.
Figure 3-15 shows two groups of instances of ALE Outbound, each of which is listening for IDOCs on a shared program ID and sharing the same TID file:
Figure 3-15 Multiple Instances of ALE Outbound Using Different Program IDs
See Configuring Multiple Program IDs
in Configuring ALE Integration in the BEA
eLink Adapter for R/3 Installation and Configuration Guide.
Managing Transactional Integrity for Outbound IDOCs
ALE Outbound manages transactional integrity for outbound IDOCs to ensure that an IDOC packet has been enqueued successfully. ALE Outbound uses a TID log file to track the transaction IDs (TIDs) associated with the IDOC packets it processes to ensure that it enqueues an IDOC packet from R/3 exactly once. See Transaction IDs (TIDs) for an introduction to TIDs.
About the TID Log File Used for Outbound IDOCs
ALE Outbound uses a TID file to track the IDOC packets it processes to ensure that it enqueues an IDOC packet once and only once. The R/3 system assigns a TID to each outbound IDOC packet.
The TID File for ALE Outbound is a log of all the TIDs that ALE Outbound has received and processed. Each row in the TID file represents the TID for a separate IDOC packet and contains three fixed-position columns of information:
Column | Description |
---|---|
Date-Time Stamp |
Date and time at which the TID log file was last updated. |
TID |
TID that R/3 assigned to the IDOC packet. |
State |
The processing state. One of the following strings:
|
The following example shows a sample TID file for ALE Outbound:
Tue Apr 27 14:27:36 1999 0A0201FD03F937262C5B0001 CONFIRMED
Tue Apr 27 14:29:38 1999 0A0201FD03E937262CD70004 CONFIRMED
Tue Apr 27 14:46:56 1999 0A0201FD03F9372630E60009 CONFIRMED
Tue Apr 27 15:50:21 1999 0A0201FD03E837263F98003F CONFIRMED
The CR3_ALEOUT_TID_FILE environment variable specifies the location of the TID log file for ALE Outbound. See Setting Environment Variables for ALE Outbound in Configuring ALE Integration in the BEA eLink Adapter for R/3 Installation and Configuration Guide for more information.
Use the cr3tidmanager program to manage the size and number of entries kept
in TID files. See Configuring the TID
File Manager in Configuring ALE Integration
in the BEA eLink Adapter for R/3 Installation and Configuration Guide.
Processing TIDs with Outbound IDOCs
Figure 3-16 shows how ALE Outbound uses the TID log file to manage transactional integrity for outbound IDOCs:
Figure 3-16 TID Processing for ALE Outbound
The information flow proceeds in the following sequence:
ALE Outbound uses TUXEDO's transaction management capabilities to ensure transactional integrity for outbound IDOCs. Figure 3-8 lists problems that can occur with outbound IDOCs:
Problem | Description |
---|---|
Unable to Lock the TID File |
The TID file might be locked by another instance of ALE Outbound or the TID File Manager. ALE Outbound retries the lock attempt. After a configurable number of retry attempts, ALE Outbound returns a lock error to R/3. R/3 then attempts to retry the operation until it succeeds or stops trying. |
Unable to Update the TID File |
The file might be corrupted. If ALE Outbound can lock the TID file but cannot update it, ALE Outbound retries the lock attempt. After a configurable number of retry attempts, ALE Outbound returns a lock error to R/3. R/3 then attempts to retry the operation until it succeeds or stops trying. |
ALE Outbound cannot enqueue an IDOC message(s) |
One or more target queues might be full. ALE Outbound returns a SAP exception to R/3, and R/3 instructs ALE Outbound to roll back the transaction. R/3 will subsequently resubmit the IDOC packet to ALE Outbound. |