Skip to Content

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.

image

More information about Interface Patterns can be found here:

http://help.sap.com/saphelp_nwpi71/helpdata/EN/11/e8179b247e4720882512a04041491d/content.htm 

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.

Source Datatype:

image

Target Datatype:

image

Outbound Asynchronous SI for FILE sender system:

image

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:

image

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:

image 

Below is the final list of objects which are created in the Enterprise Services Builder for this interface:

image

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:

image

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:

image

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:

image

This is all folks! Thanks for taking out time to read this blog. I hope that it will benefit you to some extent.

To report this post you need to login first.

8 Comments

You must be Logged on to comment or reply to a post.

  1. Michael Nicholls
    During the migration process problems have been reported for this blog. The blog content may look corrupt due to not supported HTML code on this platform. Please adjust the blog content manually before moving it to an official community.
    (0) 
    1. abhishek salvi Post author
      Hi,

      As per SAP Help section, Context Objects can be used in the Condition Editor of a Receiver Determination. Personally I have not yet experimented this option; however will update the blog once a handson is done with Context Objects.

      Thanks,
      Abhishek.

      (0) 
  2. babu babu
    Hi

    One doubt! You have given like prefix “//” to aaccess the field in source message. What about if we have two fields with the same name in the input data type. There might be ambigutiy while picking up the right field.

    Sincerely
    Amer

    (0) 
    1. abhishek salvi Post author
      Hi,
      In that case you will have to use Interface Pattern as Stateless (XI3.0 Compatible) and then using XPATH develop your condition; or create a Context Object and use it to define the condition.
      Abhishek.
      (0) 
  3. Rajeev Patkie
    Hi Abhishek,

    Nice blog. However what if we want content based routing incase of IDOC sender. I configured one scenario and found that XPATH was missing in content based routing of Receiver determination as well as in Interface determination.

    Thanks and Regards

    Rajeev

    (0) 
    1. abhishek salvi Post author
      Hi Rajeev,

      In case of IDOC sender, IDOC structure will be visible in the Receiver Determination, so you need not follow this blog. In Interface Determination, irrespective of the PI version and whether it is an IDOC or not, the entire message structure should be visible in condition editor.
      I am not sure of your problem at this moment, however did you make use of Receiver Rules? In that case you would not be able to make use of XPATH. Below is the statement taken from http://help.sap.com
      Note that you cannot specify expressions using XPath when you define conditions in receiver rules.

      One more point which I would like to highlight is that from SAP PI 7.1 with Ehp1 (SP005) the structure will be visible in Receiver Determination and from this point onwards you need not manually write the content in the expression editor.

      Regards,
      Abhishek.

      (0) 
      1. Rajeev Patkie
        Hi Abhishek,

        Actually I am looking for a condition in Interface determination where in different interfaces will be picked up based on payload values of the incoming messages.

        The problem I am facing over here is I am not able to see IDOC structure (in XPATH option) in my Interface determination drop-down and that I had to enter the condition manually.

        Regards

        Rajeev

        (0) 

Leave a Reply