Show TOC

Defining ConditionsLocate this document in the navigation structure

Use

You define a condition when you have to:

  • Forward messages to more than one receiver (Recipient List) or more than one interface (Interface Split)

  • Filter only selected incoming messages reaching the receiver.

You use this procedure to define conditions for each receiver or interface. The runtime engine evaluates these conditions and determines the target receiver or interface of a message.

Condition Editor

This editor is used to enter a condition that comprises of an expression representing a node in the message payload, a logical operator, and a specific value.

Parts of a Condition

Operands

Description

Xpath

An Xpath is a path expression used to access a particular node of a message. To see the list of message nodes defined for the relevant service interface, press Ctrl+Space after Xpath. in the Condition Editor .

Example

Xpath./p1:GetFruitPriceQuoteUS = "200" ( p1 is specified as a prefix for namespace http://sap.com/xi/BASIS)

Context Object

A context object is a design object that can be used as an abbreviated expression for an XPath expression to address a specific message node. To reuse an Xpath in multiple conditions, you can assign a context object to the message node in the ES Repository.

Context objects also represent all existing adapter-specific message attributes in the message header. The namespace for adapter-specific attributes is structured as follows: <Namespace of the adapter metadata object>/<Name of the adapter metadata object>.

Example

ContextObject.GetFruitPriceQuoteUS = "200"

For more information on how to create Context Objects in the ES Repository, see Start of the navigation path SAP NetWeaver Library: Function-Oriented View Next navigation step Process Integration Next navigation step Enterprise Services Repository & Registry Next navigation step Managing Services in the Enterprise Services Repository Next navigation step Defining Custom Services Next navigation step Working with Service Definitions Next navigation step Developing Service Interfaces Next navigation step Creating Context Objects End of the navigation path.

Operators

Description

=

Checks if the value of left-hand expression equals right-hand value.

Example

Xpath./p1:BookingOrderInformation = "01"

!=

Checks if the value of left-hand expression is not equal to the right-hand value.

Example

Xpath./p1:BookingOrderInformation != "01"

CP

Queries a pattern in a string.

Example

ContextObject.URLParamThree CP "ABC"

EXISTS

Checks the existence of a specific string in the message payload.

Example

EXISTS(Xpath./p1:BookingOrderInformation)

AND

Satisfies a condition when both the expressions are true

Example

(Xpath./p1:BookingOrderInformation = "AA" AND Xpath./p1:BookingOrderInformation/BookingOrder = "BB")

OR

Satisfies a condition when any one of the expressions is true.

Example

(Xpath./p1:BookingOrderInformation = "AA") OR (Xpath./p1:BookingOrderInformation/BookingOrder = "BB")

Procedure

Access a message node using Xpaths

  1. In the Condition Editor , under Start of the navigation path Parts of a Condition Next navigation step Expression End of the navigation path , double-click on Xpath.

  2. Press Ctrl+Space after Xpath to get a list of message nodes and double-click on the required message node to add it in the editor.

    Note

    Since Xpath with whitespaces is not supported in this release, you can create an Xpath expression containing whitespaces in the Condition Editor . Click the Create Xpath containing whitespaces link at the bottom and enter your Xpath expression in the editor. The new expression is now added to the list of message nodes.

  3. Under Parts of a Condition group, choose an operator. To know the syntax of an operator, see Suggested Use .

  4. If you want to formulate complex logical expressions, you can use Predicates in Xpath expressions.

    Example

    You have to enter a condition for- Booking number ( BookingNumber) is great than 0100. Use predicates as [BookingID/BookingNumber > 0100] and enter the logical expression in the Condition Editor as shown below:

    EXISTS(Xpath.FlightBookingOrderConfirmation[BookingID/BookingNumber > 0100])

    This condition means: A message node FlightBookingOrderConfirmation exists, and the content of subelement BookingID/BookingNumber is greater than 0100.

  5. Choose OK .

Access a message node using ContextObjects

  1. In the Condition Editor , under Start of the navigation path Parts of a Condition roup  Next navigation step Expression End of the navigation path, double-click on the ContextObject .

  2. Press Ctrl+Space after ContextObject. to get a list of context objects and double-click on the required context object to add it in the editor.

    Note

    You can see the context objects that are defined for the relevant service interface. You can also see context objects for all the existing adapter-specific message attributes in the message header.

  3. Under Parts of a Condition group, choose an operator. To know the syntax of an operator, see Suggested Use .

  4. Choose OK.

Limitation

While entering an Xpath in the Create Xpath containing whitespaces editor, do not press Enter as a part of the expression. Such a condition can fail at runtime.

More Information

Tips

Follow the tips below to avoid errors while entering expressions in the Condition Editor :

  • All the expressions must begin with an Xpath. or a ContextObject.

  • Use () to group complex conditions.

    Example

    (Xpath./BuyerParty/BuyerID = "AA" AND ContextObject.XHeaderName1 = "BB") OR (Xpath./BuyerParty/BuyerID = "AA" AND ContextObject.XHeaderName1 = "BB")

  • Enter a space between the operator and the operand.

  • If your expression contains an error, check the tooltip of the error icon at the beginning of the expression.