Programming Replicate()/SaveReplica() BAPIs 

Use

To replicate a business object instance, for example, to transfer data between two distributed systems in the context of Application Link Enabling (ALE), you can implement specific standardized BAPIs.

The objective of replicating business object types is to make specific instances of an object type available on one or more additional systems. The replicated instances are usually created under the same object key.

The interface of these BAPIs depends on the characteristics and contents of the business object that is to be replicated. For this reason replicate BAPIs must be implemented for each business object.

Business objects instances can be replicated in two ways:

Both of the above replication methods can be implemented with the BAPIs Replicate(), SaveReplica() and SaveReplicaMultiple(). These BAPIs are both class methods (instance-independent).

Features

Replicate()

The BAPI Replicate() is called in the system which contains the originals of the business object instances to be replicated. The BAPI Replicate() is used for:

The BAPI Replicate() can only request the replication of instances of a business object. The actual replication is carried out when the server system calls one of the SaveReplica() BAPIs described below on the client system.

You must follow the steps below:

  1. Select the data to be replicated.
  1. Determine the receiver.

This is done in the ALE distribution model using the function module ALE_SYNC_BAPI_GET_RECEIVER. For information about this function module, see the Section Distribution Using BAPIs in the ALE Programming Guide. You can also restrict the number of receivers in the parameter Recipients of the Replicate() BAPI.

  1. Loop via the receiver and call the relevant SaveReplica() BAPI.
  1. Enter a value in the Return parameter and complete the Replicate() BAPI.

Import Parameters

The interface of the Replicate() BAPI must contain the following parameters:

You could implement these, for example, using a range table for the key fields of the business object types or using selection parameters that enable you to select instances to be replicated. (See also Selection Parameters).

This parameter identifies the logical systems in which the business object instances are to be replicated. This parameter is based on the data element BAPILOGSYS. If this parameter is set to "initial", the receiver is determined using the ALE distribution model.

For information about extension parameters and recommendations on how the customer enhancement concept should be implemented in a Replicate() BAPI, see Customer Enhancements to BAPIs.

The interface of the Replicate() BAPI can also contain the following parameters:

This parameter enables modifications of object instances already replicated to be copied directly from engineering change management and forwarded to the receiving system. You should only use this parameter if the business object type in question provides engineering change management.

Structure this parameter on the data element RQSTCHNG. This can have the following values:

The parameter RequestChanges must not be used together with the Recipients parameter, because the change pointers in change management are reset, if change management is accessed by the receiver. Other receivers may then not be allowed access. Documentation on this parameter must refer explicitly to this connectivity.

Export Parameters

The BAPI Replicate() should contain the following export parameters:

For more information about this parameter, see Return Parameters (Error Handling).

For information about extension parameters and recommendations on how the customer enhancement concept should be implemented in a Replicate() BAPI, see Customer Enhancements to BAPIs.

SaveReplica() and SaveReplicaMultiple()

The class method SaveReplica() and the method SaveReplicaMultiple() generate replicates of business object instances. They are used to replicate objects in different systems that are semantically identical. For technical reasons these objects may be created with different objects keys (object IDs).

The BAPI SaveReplica() is used by a system to replicate one business object instance on a target system or to modify one business object that has already been replicated. Whilst the SaveReplicaMultiple() BAPI can replicate several business object instances on the target system or modify several instances that have already been replicated.

For each business object type to be replicated you have to implement one or both of these methods, according to your requirements.

Import Parameters

You should keep the following points in mind when defining the import parameters:

For further information see Test Run Parameters.

Export Parameters

You should keep the following points in mind when defining the export parameters:

For information about extension parameters and recommendations on how the customer enhancement concept should be implemented in a SaveReplica() BAPI, see Customer Enhancements to BAPIs.

You should keep the following points in mind:

If this information exceeds the maximum capacity of MESSAGE_V2 (that is, 50 characters), the remaining characters can be entered in the field MESSAGE_V3.

The meaning of the various fields is the same as for successful execution.

For more information about this parameter, see Return Parameters (Error Handling).

See also:

Example of a SaveReplica() BAPI