About Application Adapters

About Sun Adapter for SAP ALE

SAP ALE (Application Link Enabling) is a technology for exchange of business data between multiple SAP R/3 systems or SAP R/3 and customer applications. The vehicle for data exchange is an IDoc (Intermediate Document), which is basically a SAP defined message structure that serves as a container for the different types of application data being transmitted.

ALE provides SAP customers with a program distribution model and technology that enables them to transfer IDocs across various platforms and systems.

The SAP IDoc Format

IDocs are used as containers for information, and are used to exchange business data between systems.

Several hundred IDocs are supplied with each SAP R/3 system, serving as templates for a wide variety of applications. The IDoc hierarchy is represented by the following terminology:

The SAP ALE Adapter

The SAP ALE IDOC Object Type Definition (OTD), when used with the SAP BAPI Adapter in Transactional Remote Function Call (tRFC) mode, enables Sun Java Composite Application Platform Suite (Java CAPS) Projects to exchange data with SAP R/3 software using SAP’s Intermediate Documents (IDocs) via the Application Link Enabling (ALE) interface.

The next two sections provide an overview of how to use the IDoc OTD and the SAP BAPI Adapter to send or receive IDocs to SAP R/3.

Inbound Data Flow: SAP R/3 to Java CAPS

During routine operations, an application on the SAP R/3 system generates a transaction designated for an external system. The ALE interface converts the data from the internal data format to the IDoc format, and sends it via tRFC to the SAP BAPI Adapter, acting as a RFC server.

The Java CAPS Project’s business rules receive the IDoc data from the SAP BAPI Adapter, performs any necessary processing or routing, and sends the information to another Adapter connected to the recipient system. Any necessary data transformation required for the target application is performed in your Project Collaborations.

  1. The Adapter reads in the required configuration parameters and establishes a network connection with the SAP R/3 system. The Adapter acts an RFC server, receiving IDocs from the SAP R/3 system.

  2. When the IDoc is sent from SAP R/3 via tRFC, the SAP BAPI Adapter uses the RFC OTD, IDOC_INBOUND_ASYNCHRONOUS, to receive the IDoc data.

  3. IDoc data received by the IDOC_INBOUND_ASYNCHRONOUS OTD can be marshaled out of the OTD and unmarshaled into a IDoc OTD.

  4. A file-based TID (Transactional ID) database is used to track transactions that have been committed successfully or rolled back.

  5. If identified successfully, the process moves on to the next step. If not, the Adapter composes the appropriate response and logs an exception in the log file.

  6. If the Collaboration or Business Process fails, an exception is logged in the log file raised back to SAP R/3.

  7. The Adapter then repeats the procedure beginning with step 2.

Outbound Data Flow: Java CAPS to SAP R/3

In the outbound mode, you must first get the data into the IDoc OTD using its unmarshal method. From the IDoc OTD, you unmarshal the data into the IDOC_INBOUND_ASYNCHRONOUS RFC OTD which sends the IDoc to SAP R/3 using tRFC protocol.

  1. When the Collaboration or Business Process starts to run, the Adapter is initialized with its configuration properties.

  2. The data is unmarshaled to the IDoc OTD before being sent to the SAP BAPI Adapter’s RFC OTD---IDOC_INBOUND_ASYNCHRONOUS.

  3. The SAP BAPI Adapter transmits the data to SAP R/3.

  4. The SAP BAPI Adapter associates the next TID (from a persistent resetable counter) with the transformed outbound message and sends it via tRFC to the SAP R/3 host.

  5. If no exceptions are raised by the receiving SAP R/3 host, the next TID is incremented.

  6. The Adapter repeats the procedure beginning with step 2.

Messages are sent to the SAP R/3 host via Transactional RFC (tRFC). With tRFC, the receiving SAP R/3 system relies on an unique Transactional ID (TID) sent with the message to ascertain whether or not a transaction has ever been processed by it before. The SAP BAPI Adapter assumes that all messages handled are new and assigns a new TID to each message.


Note –

If you have IDoc data in a byte array format you may unmarshal it directly to the IDOC_INBOUND_ASYNCHRONOUS OTD without using the IDoc OTD first.