Transaction Handling
Managing Transactions and the Transaction Store
Adapter for SAP comes with a transaction manager that allows you to monitor the transaction state for all messages associated with a transaction ID that uniquely identifies the transaction. The transaction ID can be up to 24 alpha numeric characters in length. If Adapter for SAP receives a message without a transaction ID, it can create one for the message.
The message itself is stored in the transaction store. The transaction store can be a directory in the file system or in a MySQL database. By default, the transaction store is located in the file system on Integration Server on which an individual Adapter for SAP is installed. Alternatively, it can be centrally located in an external directory in the file system or in a MySQL database shared by a group of Adapter for SAP (Shared Transaction Store) or on an Integration Server on which one Adapter for SAP is designated as the server, and is available to a group of adapters for SAP (Central Transaction Store) . For complete information about configuring and working with the Shared Transaction Store, see Shared Transaction Store.
- Transactions are stored in a directory in the file system for local transactions by default.
- Transactions are stored in a directory in the file system if multiple Adapter for SAP instances are configured for CTS or STS.
- Transactions can be stored in a MySQL database for a single or multiple Adapter for SAP instances.
Use the Transactions screens to view and manage the transactions that Adapter for SAP records in its transaction store. Here you can view transactions and their processing log as well as delete transactions that are no longer needed.
Viewing Transactions
About this task
You view transactions for a local Transaction Store, or a Centralized Transaction Store (CTS) or a Shared Transaction Store (STS) in the same way. In a local Transaction Store, you can view only the transactions executed by that individual adapter; in a CTS or STS, you can view the status of all the transactions executed by any adapter in the group.
To view the transactions in the transaction store
Procedure
Deleting Transactions
About this task
You delete transactions from a local Transaction Store and a Centralized Transaction Store (CTS) or a Shared Transaction Store (STS) in the same way. If a transaction store contains transactions that are no longer needed, you can delete them. In a local Transaction Store, you can delete only the transactions executed by that individual adapter; in a CTS or STS, you can delete any transaction executed by any adapter in the group.
To delete transactions from the transaction store
Procedure
Automatic Cleanup of the Transaction Stores
About this task
As the size of the transaction store increases, you should consider creating a flow service that periodically purges the store of transactions that are no longer needed.
- To clean up a local Transaction Store, configure the flow service on each adapter.
- To clean up a Centralized Transaction Store or a Shared Transaction Store, configure the flow service on only one of the adapters for SAP in the adapter group. For best performance this should be Adapter for SAP that is the CTS server.
To purge certain transactions from the transaction store periodically
Procedure
Example
To periodically purge all transactions that have been in the Confirmed state for longer than 30 minutes, you can create a service called app:purgeConfirmedTRX with those state and time parameters. You also specify how many transactions every invocation of the service will purge. This is so you can control the pace of your maintenance jobs without putting to much load on Integration Server at one single time. It is also a good idea to schedule the job at times when there is not much load on Integration Server.
Configuration Parameters for the Transaction Manager
The transaction store reacts to the following configuration parameters, which can be set in the file <install_dir>\config\server.cnf or per routing/RFC listener or on the notification level for a local Transaction Store and for a Centralized Transaction Store Server only. Some of these settings influence the performance of the transaction store.
- On each RFC Listener and on the routing listener you can
set field "Store message body" to "On" or "Off".
If this parameter is set to "Off", Adapter for SAP does not save the message body of incoming transactions.
- On each RFC Listener and on the routing listener you can
set field "Log transaction status" to "On" or "Off".
If this parameter is set to "Off", Adapter for SAP does not maintain any transaction and status information in the transaction store.
- On each ALE Notification and for the Routing Notification
you can set field "Monitor IDocs" to "On" or "Off".
If this parameter is set to "On", Adapter for SAP links the IDoc packet's TID with the DOCNUMs of the IDocs in that packet, so that later ALE IDoc Monitoring is possible. See Using the ALE Monitoring Features Via Adapter for SAP for more information.
- watt.sap.xtn.cacheFlushPeriod
For more information, see watt.sap.xtn.cacheFlushPeriod.
- watt.sap.xtn.cacheTimeToLive
For more information, see watt.sap.xtn.cacheTimeToLive.
- watt.sap.xtn.fastAsyncMode
For more information, see watt.sap.xtn.fastAsyncMode.
Using the ALE Monitoring Features Via Adapter for SAP
You can monitor the ALE transactions for a local Transaction Store and for a Centralized Transaction Store (CTS) in the same way, as described below. The behavior of monitoring will not change because the transactions are executed by individual adapters even in a CTS setup. Only the transaction results are stored in a CTS server.
When an IDoc is sent from an SAP system to Adapter for SAP, the status of the IDoc (as displayed in WE02) will always be "03, Data passed to port OK" (passed to the tRFC queue of the SAP system). However, this status does not provide any information regarding whether the IDoc could be processed successfully by Adapter for SAP and who the final recipient was. To get this kind of information, Adapter for SAP offers three options: IDoc Trace, ALEAUD IDoc and SYSTAT IDoc.
The IDoc Trace feature should be used if you sporadically want to look up the status of certain IDocs. The lookup is done manually and only for a specific selection of IDocs. If you want automatic status update, you should use one of the other two options described below.
Status update via ALEAUD IDoc can be used if the final recipient is again another SAP system. The most common case will be the connection of two SAP systems via the Internet like this:
SAP system (sender) -> Integration Server 1 ->Internet (http) -> Integration Server 2 -> SAP system (receiver).
In all other cases, status update via SYSTAT IDoc must be used. Integration Server acts here like an EDI Subsystem and returns status information and information about the final receiver (receiving e-mail address, Web Server URL, FTP Server, third party system, etc.) to the sender.
IDoc Trace
Overview
The ALE Monitor allows you to make inquiries about the processing status of an IDoc in the receiving system actively from within the sending system. In SAP systems of release < 4.6C this can be done with the transaction BDM2 (Cross System IDoc Reporting) and from release 4.6C on with transaction BD87 (Status Monitor for ALE Messages). As inputs you can specify certain selection criteria, like Document Number, Message Type, LS of receiver and date ranges. The system then makes a synchronous RFC call (IDOC_DATE_TIME_GET) to the LS that received the IDocs, with a list of DOCNUMs corresponding to the selected IDocs. (From transaction BD87 you have to hit the toolbar button "Trace IDocs" after the selection of the IDocs.) This function call returns for each IDoc the DOCNUM, under which it was saved in the receiving system, the receiving time and the current processing status in the receiving system.
Prerequisites
- The IDoc Trace functionality only works for IDocs exchanged between partners of Partner Type LS (Logical System).
- In order to be able to make this synchronous RFC, the partner profile of the LS, which represents Integration Server, must contain an outbound parameter with message type SYNCH.
- Also the Function Call to an LS of type "tRFC Port",
like Integration Server, is only executed if
the SAP system is of release 4.6D or higher. For older releases you have to apply the following hot packages:
R/3 Release Hot Package 3.1I SAPKH31I67 4.0B SAPKH40B56 4.5B SAPKH45B35 4.6B SAPKB46B22 and SAPKH46B22 4.6C SAPKB46C11 and SAPKH46C11
Prepare Adapter for SAP for IDoc Trace
To set up Adapter for SAP for IDoc tracing proceed along the following steps:
- For your routing notification or ALE adapter notification you want to monitor IDocs, set the value for field "Monitor IDocs" to "On" using Designer.
- For each SAP system from which you want to receive and trace IDocs, create an RFC adapter notification for IDOC_DATE_TIME_GET and assign service pub.sap.monitor.idoc:trace.
However, if the IDoc is forwarded to an SAP system (either by invoking a routing notification with outbound transport set to ALE or by invoking pub.sap.transport.ALE:OutboundProcess or pub.sap.client:sendIDoc directly or from a remote Integration Server) Adapter for SAP invokes IDOC_DATE_TIME_GET directly against the receiving SAP system. This action returns additional information, like the IDoc number, from the receiving SAP system. All remote Integration Servers that receive IDocs via a remote invocation of pub.sap.transport.ALE:InboundProcess should therefore also support IDoc Tracing.
Status Update Via ALEAUD IDoc
Preparation
If the final receiver is an SAP system, the IDoc ALEAUD can be used to report status information from the receiver back to the sender. To setup this scenario, the following settings have to be created in the distribution models of the participating Systems:
(MATMAS is used in this example)
- Sending SAP System: For the LS that represents the receiver, set up a partner profile, that has MATMAS as an outbound parameter and ALEAUD with process code AUD1 as an inbound parameter.
- Receiving SAP System: For the LS that represents the sender, set up a partner profile with an
outbound parameter ALEAUD and an inbound parameter MATMAS. Also in the distribution model the following model view
has to be created:
Sender: T90CLNT090 (or LS, which received the IDoc, if different)
Receiver:LS of sender
Message type: ALEAUD
Here add a Filter with value "MATMAS".
Next you have to schedule a job, which executes a variant of the report RBDSTATE. The variant has to include the LS of the sender as selection parameter. This should send out an ALEAUD IDoc to the Integration Server.
Further Setup in Adapter for SAP
About this task
To set up Adapter for SAP for status update via ALEAUD proceed along the following steps
Procedure
Status Update Via SYSTAT IDoc
Overview
In this case Integration Server can be considered as a kind of EDI Subsystem. If the SYSTAT feature is enabled, it automatically sends a customary EDI Subsystem Status and some additional information for each IDoc it received back to the original sender. You can decide for each routing notification or ALE adapter notification whether SYSTAT information should be reported to the sender or not. The following information is then reported in addition to the status:
- Program that set the status (Adapter for SAP)
- Routing notification or ALE adapter notification that processed the IDoc
- The key (TID) under which the IDoc can be found in Adapter for SAP
- Date and time of status change
- In case of an error status: explicit error message
- In case of a success status: explicit information about the final receiver
Adapter for SAP sends the following status:
- If everything went ok the first time: "
06 Translation OK" and "12 Dispatch OK" - If an error has occurred the first time: "
11 Error during dispatch" - If everything went ok at a later retrial: "
13 Retransmission OK" - If there was still an error at a later retrial:
"
23 Error during retransmission" - If no information on the IDoc could be determined:
"
04 Error within control information of EDI subsystem"
Set Up the Participating SAP Systems
In each SAP system that is to receive SYSTAT IDocs from Integration Server, you need to configure the following settings:
In SAP systems of Release 3.1H - 3.1I you need to perform the following additional step, before continuing with the general setup:
Go to WE42 (Process codes, inbound) and open the two tree branches Inbound with ALE service > Processing by task and Inbound without ALE service > Processing by task. You need to reassign the process code STA1 from without ALE service to with ALE service, if this has not already been done. To do this, proceed as follows:
- Mark the node Inbound without ALE service > Processing by task > STA1 Status record from IDoc with the cursor and then press the Reassign button (F6).
- Confirm the popup
- Double click on the node Inbound with ALE service _ Processing by task
- In the following screen press the Save button (F11).
General setup:
- Open SALE (Distribution (ALE)) and select Basis configuration > Set up logical system
- >
Maintain logical systems to add a new logical system for the Integration Server if you do not have one yet. If
you name it
BUSCON, the Integration Server will recognize it automatically; otherwise, you will have to make the name known to the Integration Server as described later. - In WE20 (Partner Profiles), create a partner profile
with Partn.number =the name you chose in step 1 (
BUSCON) and Partn.type = LS. After you saved it, add an Inbound Parameter to it as follows:Message type =
STATUSProcess code =
STA1
Prepare Integration Server for Automatic SYSTAT IDoc
About this task
In the Integration Server, you have to setup these elements to enable automatic status update via SYSTAT:
Procedure
Shared Transaction Store
As an alternative to storing transaction information locally, Adapter for SAP provides a Shared Transaction Store (STS) configuration that enables you to run several Adapter for SAP in parallel to improve reliability. The STS manages the transaction states for multiple Adapters for SAP, and can be used with either Integration Server cluster or with a group of Adapter for SAP on independent Integration Servers. By providing a central location in which to store transaction information, an STS ensures that the status of incoming tRFCs will remain valid and consistent throughout the adapter group. For more information about using the transaction stores, see Considerations about Adapter for SAP Centralized Transaction Store or Shared Transaction Store
Adapter for SAP group refers to a number of adapters for SAP that belong logically together, that share a single STS and, by sharing the STS, allow reliable tRFC/IDoc load balancing. There can be only one STS per adapter group. All adapters for SAP that are configured to use a specific STS are considered to be in the same group.
To use the STS, configure all the adapters for SAP to use the same external shared directory as transaction store location. For configuration instructions, see Configuring a Shared Transaction Store.
When a transaction is processed by any of the adapter for SAP in the adapter group , the adapter stores the transaction status in the external shared directory, which can be accessed by all the other adapters for SAP in the same group. Note that the way in which the transactions are processed is the same as if they were stored locally, but the status of the processed transactions is stored in the STS Server instead of storing the status locally on each adapter in the group.
Use the Transactions screens to view and manage the transactions that the Adapter for SAP records in the STS. For more information, see:
For additional performance and configuration tasks, see:
Centralized Transaction Store
As an alternative to storing transaction information locally, Adapter for SAP provides a Centralized Transaction Store (CTS) that enables you to run several adapters for SAP in parallel to improve reliability. The CTS manages the transaction states for multiple adapters for SAP, and can be used with either Integration Server cluster or with a group of adapters for SAP on independent Integration Servers. By providing a central location in which to store transaction information, a CTS ensures that the status of incoming tRFCs will remain valid and consistent throughout the cluster or adapter group. For more information about using the transaction stores, see Considerations about Adapter for SAP Centralized Transaction Store or Shared Transaction Store.
Adapter for SAP group refers to a number of adapters for SAP that belong logically together, that share a single CTS and, by sharing the CTS, allow reliable tRFC/IDoc load balancing. There can be only one CTS per adapter group. All adapters for SAP that are configured to share a specific CTS are considered to be in the same group.
To use the Centralized Transaction Store, configure one of the adapters for SAP as the Centralized Transaction Store Server and configure the rest of the adapters for SAP in the group as Centralized Transaction Store Clients. You configure the Remote Server with an alias of "SAPGroupStore" for each Adapter for SAP of your adapter group (and in exactly the same way). For configuration instructions, see Configuring a Centralized Transaction Store (Server).
When a transaction is processed either by the Centralized Transaction Store Server or by any of the Centralized Transaction Store Clients, the adapter stores the transaction status in the server, which can accessed by the adapter server and all the adapter clients. Note that the way in which the transactions are processed is the same as if they were stored locally, but the status of the processed transactions is stored in the Centralized Transaction Store Server instead of storing the status locally on each adapter in the group.
Use the Transactions screens to view and manage the transactions that Adapter for SAP records in the CTS. For more information, see:
For additional performance and configuration tasks, see:
- Automatic Cleanup of the Transaction Stores
- Configuration Parameters for the Transaction Manager
- Using the ALE Monitoring Features Via Adapter for SAP
- Configuring a Centralized Transaction Store (Server)
- Viewing Centralized Store Configuration and Status
- Removing the Configuration of a Centralized Transaction Store
To migrate the CTS configuration into an STS configuration
- Create a directory with write access in the file system which can be accessed by all the adapters for SAP in the adapter group. For improved reliability, this directory could be located on an external high-reliability NAS.
- For all Adapter for SAP in the adapter group, set the configuration switch
watt.sap.xtn.cts.txstore to the directory created in the above step.
The switch can be set in Integration Server Administrator. Click Settings > Extended > Edit Extended Settings.
In the Extended Settings editor, add watt.sap.xtn.cts.txstore property to specify the shared directory.
Click Save Changes. The property appears in the Extended Settings list.
- Remove the CTS configuration as described in Removing the Configuration of a Centralized Transaction Store for each CTS client in the adapter group. Then shut down all the CTS client adapters.
- Remove the CTS configuration as described in Removing the Configuration of a Centralized Transaction Store for the CTS server. Then shut down the CTS server adapter.
- Copy the complete contents of packages_directory\WmSAP\txStore directory of the CTS server adapter to the directory created in Step 1.
- Restart all the adapters for SAP in the adapter group. The adapters will now use the STS located in the directory created in step 1.
Configuring a Shared Transaction Store
About this task
Use the following instructions to configure a Shared Transaction Store Server.
To configure the Shared Transaction Store
Procedure
Results
To disable STS configuration and switch back to Local Transaction Store, remove the watt.sap.xtn.cts.txstore property in Extended Settings and restart Integration Server.
Configuring a Centralized Transaction Store (Server)
About this task
Use the following instructions to configure a Centralized Transaction Store Server.
To configure the Centralized Transaction Store (Server)
Procedure
Results
To view the configuration and the status of the store, see Viewing Centralized Store Configuration and Status.
Configuring a Centralized Transaction Store (Client)
About this task
Use the following instructions to configure Centralized Transaction Store Clients.
To configure the Centralized Transaction Store (Client)
Procedure
Results
To view the configuration and the status of the store, see Viewing Centralized Store Configuration and Status.
Viewing Centralized Store Configuration and Status
About this task
To view the centralized store configuration and status
Procedure
- In the Adapters menu in the navigation area of the Integration Server Administrator, click Adapter for SAP.
- In Adapter for SAP menu in the navigation area of Adapter for SAP, click Settings.
Results
At the bottom of the page, you can view the configuration details of Adapter for SAP Group. The Centralized Store field must display Local File System for Centralized Transaction Store Server and Remote File system <server IP Address> for Centralized Transaction Store Clients.
Removing the Configuration of a Centralized Transaction Store
About this task
If you no longer want a particular Adapter for SAP to use the Centralized Transaction Store (CTS), you can remove or rename the adapter's Remote Server with alias SAPGroupStore by following the instructions in this section.
If you remove the Remote server for Adapter for SAP that is a CTS Client, the CTS Server will display that particular client's status as Inactive in the adapter's Settings page. After reloading the WmSAP package or restarting the Integration Server, Adapter for SAP, the adapter will use its local Transaction Store to persist transaction information.
Do not remove or rename the Remote Server Alias for SAPGroupStore while Adapter for SAP is still processing messages. Otherwise the transaction status of these messages could be lost or become invalid.
From Adapter for SAP that you want to remove from the CTS
Procedure
Results
The affected Adapter for SAP does not register itself with the CTS server during adapter start-up, and will now use its local Transaction Store instead of the CTS to persist all transactions. By doing so, the adapter is effectively no longer part of the logical group of adapters.