In Standard receiver determination you can specify the receivers of the message manually (with optional routing conditions).
Conditions relate to the content of the message. While defining the condition, you can only specify an element from the message payload using expression editor to create an expression for the left operand and you must specify a fixed value in the right operand, against which the value of the element will be compared at runtime. You can use only these (=,, ,EX) operators. So the functionalities are limited.
In the Enhanced Receiver Determination, Instead of creating the receivers in the receiver determination manually, you assign an Interface mapping to the receiver determination and this returns a list of receivers at runtime.
A typical usage case is if you do not yet know the names of the receivers at configuration time. In this case, you can define a mapping program, for example, which reads a list of receivers from a table or from the payload of the message at runtime. So all the functionalities of message mapping can be used.
In interface mapping, you assign the abstract message interface ReceiverDetermination as the target interface.
The message interface ReceiverDetermination is in the Integration Repository in the software component SAP BASIS (namespace _http://sap.com/xi/XI/System)_.
The message interface uses the message type Receivers and the data type Receivers. The data type Receivers describes a list of receivers and has the following structure:
Separate Employees based on designation (Example ABAPER and PI consultant) ABAP Employees details are send to one receiver only if there is atleast one employee who is ABAPER and PI Consultant details are send to other receiver with a condition that there should be atleast two PI consultants.
Step to be maintained in Integration Repository
- Create one Source Data type.
- Create two Target date type.
- Second Target Data Type ( DT_PI_Employees).
- Create Message Types.
MT_Employee_Src, MT_ABAP_Employees_Trg, and MT_PI_Employees_Trg for the data types created above.
- Create one Outbound Asynchronous Message Interfaces and two Inbound Asynchronous Message Interface.
- Create three Message mapping as shown below (MM_ABAP_Employees)
- Second Message Mapping (MM_PI_Employees).
Define Message mapping to determine the receivers at runtime. Assign the message type Receivers as the target Message Type from the namespace http://sap.com/xi/XI/System.
- Test_Condition is a UDF to assign the receivers based on the condition .the receiver Business System BS_FILE_RECEIVER is added if there is at least one ABAPER and the receiver Business System BS_FILE_RECEIVER is added if there is at least two PI consultants.
- Create three Interfaces mapping as shown below
- Second Interface Mapping (IM_PI_Employees).
- Define the Third Interface Mapping(IM_TestEnhancedReceiverDetermination). Assign the message interface ReceiverDetermination as the target interface and assaign also the message Mapping to the Interface Mapping.
- Create a scenario and name it then save it. Add Business Systems to your Scenario (1 as Sender, 2 as Receivers).
- Create one sender file adapter communication channel and two receiver file adapter communication channel.
- Create Receiver determination, choose Extended and assign Interface Mapping created in IR to determine the receivers dynamically. !ERD.png!At Runtime If a Receiver Is Not Found you can choose any of the three options specified under If No Receiver is found proceed as follows (I have chosen Terminate Message processing with error).
- Create two Interface Determination as shown below .
- Second Interface Determination
- Create a Sender agreement
- Create two Receiver agreements as shown below
- Second Receiver Agreement.
Test the Scenario
Case1:Two Output Files
1.PI consultants details.
2.ABAP Employee Details.
Only one Output File with ABAP Employees Details.