SAP PI7.1, Receiver Determination, XPATH and You!
SAP PI7.1 not only brought a great deal of functionalities but also had some secrets with it. In this blog I will try to unveil one such not so known secret of SAP PI7.1.
Many times we need to route a message to a particular Receiver based on some value in the source message. How can I manage to do this? Simple, by specifying the corresponding condition in the Receiver Determination. But now PI7.1 has its own way of specifying the condition.
Firstly we need to have some knowledge about Service Interface in PI7.1. A Service Interface defines the mode and category of message execution. A parameter, Interface Pattern, of the Service Interface states which message protocol is used in message processing. This protocol is in accordance with that supported by the corresponding end system. The available Interface Patterns are Stateful, Stateless, Stateless (XI 3.0 Compatible) and TU&C/C.
More information about Interface Patterns can be found here:
Interface Patterns not only affect message processing but also how the condition needs to be specified in the Receiver Determination. In a normal procedure we select the XPATH of the source message node in condition editor and then build the condition accordingly. Now in SAP PI7.1 you can view the message structure in condition editor of Receiver Determination only when the Interface Pattern is Stateless (XI 3.0 Compatible). No message structure will be visible for other Interface Pattern options. So how should we proceed to define the condition in such a case? To demonstrate let us create a simple FILE to FILE scenario in SAP PI7.1.
Outbound Asynchronous SI for FILE sender system:
While building this Service Interface I have selected the Interface Pattern as Stateless. In real-time scenario, the Interface Pattern value needs to be selected as per the requirement.
Inbound Asynchronous SI for FILE receiver system:
For the scope of this blog there is no restriction on selection of Interface Pattern of the receiver Service Interface.
A simple mapping program is implemented between the source and target structures:
Below is the final list of objects which are created in the Enterprise Services Builder for this interface:
Once all the relevant objects are created, make sure that you save and activate the changes.
In Integration Directory below objects are created for this interface:
One sender and receiver Business Component, respectively.
One sender and receiver FILE communication channel, respectively.
one Receiver Determination, Interface Determination, Sender and Receiver Agreement, respectively.
All these objects are included under the configuration scenario object viz., CS_TestXpath.
All the objects are maintained in the same way as it was for PI7.0 (barring the receiver determination). Below figure depicts the complete list of configuration objects created:
Now we move on to create the condition in Receiver Determination. A logic needs to applied such that the file is routed to the receiver only when the MT_EmpDateSend/OfficialDetails/CompanySpecific/EmpID field exists and is not blank. When you open the condition editor of the Receiver Determination and try to define the left operand, you wont find any message structure available. This is due to the Interface Pattern value that we selected in the sender Service Interface. Below figure will depict how the left operand has to be specified:
Checkout how the left operand is specified! The actual field name has to be used and needs to preceeded by “//”; so now our left operand becomes //EmpID. Question that should now come to your mind is where should I specify //EmpID? It needs to be specified in the XPATH section of your Expression Editor.Condition definition for Interface Pattern Stateless (XI 3.0 Compatible) remains the same as it was in the earlier versions.
Once the objects are created ensure that they are saved and activated. Now we are ready for testing our scenario. Place the relevant file in the source directory mentioned in the sender FILE communication channel and if all the configurations/ condition criteria are met, then you will find the output file in the configured target directory.
Now the question before me is how should I make you believe that the above mentioned settings worked for me and the file was routed as per the condition? For this you can check the below trace details from SXMB_MONI:
This is all folks! Thanks for taking out time to read this blog. I hope that it will benefit you to some extent.