Dynamic Routing in SAP PI 7.31
This article will describe the steps to dynamically determine the receiver of
incoming message in PI and the use of Parameter in Operation Mapping and NWDS
in PI 7.31.
Requirement: Sometimes determining the receiver using the simple static routing rules for the incoming messages is not straight forward. In this scenario, the receiver is determined based on qualifiers of the incoming message and to configure runtime behavior to ensure that the names of the receivers are determined at runtime by a mapping program.
Aim: This blog explains the solution in which an operation mapping is used to dynamically determine the receiver of the incoming message. It also explains the use of a parameter in Operation mapping. A parameter (like a variable in ABAP) can be defined in the mapping and the value can be assigned in NWDS. Parameter can be used if the receiver system is different based on the environments like SAP system. This value can be replaced with the current SAP system (Dev, QA and Prod).In any project, this dynamic routing can be used by creating a separate message mapping and operation mapping program to determine the receivers and use the same in Integration Directory.
- Define a separate Mapping for dynamic Receiver
determination. In this mapping the source is the incoming message and the
target is the Message type Receivers. This message type is provided by SAP
under the software component of SAP BASIS and namespace of http://sap.com/xi/XI/System. The receiver system based on the routing logic is mapped to SERVICE of the Receivers as shown below.
2. The parameter that we want to use in the
mapping above needs to be defined in Signature tab of the message mapping and then
can be used in the mapping as constants.
3. Define an Operation Mapping for dynamic routing.
In this operation mapping the sender interface is your usual sender interface but the receiver interface is Receiver Determination which is again available in the same software component as that of Receivers and the mapping used is the one created above for determining the receivers. Once the mapping is selected, create the binding for the message mapping parameter and the operation mapping parameters.
4. The testing of the mapping can be done in the
usual way – except for the value for the parameter can be given in ‘Parameters’
tab of Test.
5. Configure the interface in NWDS as dynamic message router.
6. Now the same Operation Mapping is to be configured in NWDS using the dynamic routing. The Parameter that we have
defined in ESR automatically appears once the Operation Mapping is selected.The value for the Parameter can be given here in each system to determine the receiver dynamically.
Summary: This completes the requirement and the steps to achieve the same. To recall,
this method is used to determine the receivers at runtime by a mapping program
using the parameter. And to achieve this, a dynamic operation mapping is
defined and a parameter is declared for a receiver, binding for the same needs
to be done in ESR. Finally this is configured in the NWDS to make this