Show TOC

Function documentationUsing the Expression Editor Locate this document in the navigation structure

 

The expression editor enables you to define or select expressions. You have the following options:

  • Define constants

  • Select variables (container elements)

  • Access a particular field in a message

To make things easier, the appearance of the expression editor changes automatically according to the current situation; in other words, the expression editor only shows those fields that are relevant in the current situation. For this reason, all functions are not always available at the same time.

Note Note

Note that when using the expression editor in the Integration Directory, all constants you enter will be interpreted as string. This applies particularly for dates and times.

When entering expressions in integration processes, you must use the correct format for dates and times.

More information: XSD Data Types

End of the note.

Features

Define Constants

Define Constants

You define constants to define the comparison value for a condition, for example.

  1. Enter a name for the constant.

  2. Select the corresponding XSD data type.

    More information: XSD Data Types

    Caution Caution

    If you want to use Date and Time in an integration process, you must use the following format:

    Date: YYYY-MM-DD

    Time: hh:mm:ss

    This means that you must not enter any negative times (using the minus sign) or use time zones. If you do, a warning is displayed.

    End of the caution.
Select Variables
  1. Select the required variable.

    You can select from the following variables:

    • Simple variable: Shows container elements for the category Simple Type, which are used for counters, for example.

    • Receiver: Shows container elements for the category Receiver, which are used for the receivers of messages.

    • Interface variable: Shows container elements for the category Abstract Interface, which is used for messages.

  2. If the variable is defined as a list, in the Index field, specify which item in the list you want to access.

    You can enter the item as a whole number (for example, 2 for the second item in the list), or select the expression that returns the required item.

    A variable is a list when the Multiline indicator is set in the container when the relevant variable is defined.

Access a Field in a Message

Access a Field in a Message

If you want to access a particular field of a message, you can do so by means of a context object or by using XPath.

Specify Context Object

  1. Select the required interface variable.

  2. Define how the field is to be accessed:

    Select the corresponding context object.

    The expression editor shows the context objects that are defined for the relevant service interface, and the technical context objects (namespace http://sap.com/xi/XI/System).

    It also shows the context objects for 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>

    Pay particular attention to this convention when developing your own adapters (which you develop in a separate namespace).

    All adapter metadata shipped by SAP is located in the namespace http://sap.com/xi/XI/System. The namespace for the context objects of these adapter-specific attributes is therefore structured as follows: http://sap.com/xi/XI/System/<Name of the adapter metadata object>

    Example Example

    An example of an adapter-specific attribute for the sender RFC adapter is: RfcDestination http://sap.com/xi/XI/System/RFC

    In this example, RfcDestination is the name of the attribute and RFC is the name of the adapter metadata object (in the namespace http://sap.com/xi/XI/System) in which the attribute is defined.

    End of the example.

    Caution Caution

    If you want to access an adapter-specific attribute in the message header, when you configure the respective adapter you need to ensure that the attribute is activated.

    More information:

    Context Objects

    Technical Context Objects

    Adapter-Specific Attributes in the Message Header

    End of the caution.

Specify XPath Expression

  1. Select the required interface variable.

  2. Define how the field is to be accessed:

    To use XPath, expand the structure of the message and double-click the required field.

    If the field contains a structure, select Multiline.

    Note Note

    An XPath expression is multiline if it returns a list. If the relevant checkbox has been selected, the evaluation of the expression will take into account that it is a list (and not a single value).

    End of the note.

    Example Example

    The condition <Expression>=a is interpreted differently, depending on whether <Expression> is a single or multiline expression:

    <Expression> is a simple expression: <Expression> is equal to a

    <Expression> is a multiline expression: <Expression> is a list that contains the value a

    End of the example.

    If the element in the message that you want to access is qualified by a namespace, you must give the namespace a prefix. The prefix is then used as an abbreviation of the namespace in XPath expressions.

    To specify a prefix-namespace pair, add a new line in the table under the XPath expression and assign a prefix to a namespace (Prefix and Namespace columns).

    If you transfer an XPath expression from the structure of the message, the corresponding prefix-namespace-pair is created automatically.

Notes Regarding the Use of XPath Expressions

Note that XPath expressions created with the expression editor can only return items of type node (node, node set). For technical reasons, other types (such as Boolean value) are not permitted.

To formulate more complex logical expressions and conditions, you can use Predicates (syntax components in angle brackets) in XPath expressions.

Example Example

You want to formulate the following condition: The booking number (BookingNumber) is great than 0100.

Since the greater than > operator is not available in the condition editor, you can use the following solution: You define the relevant logical expression in the expression editor by means of an XPath predicate, and assign it to a node element. Using the condition editor you then just query the existence of this node element (by using the existence operator (EX).

This means you first create the following expression in the expression editor:

/FlightBookingOrderConfirmation [BookingID/BookingNumber > 0100]

Using the condition editor, you then formulate the following condition:

(/FlightBookingOrderConfirmation [BookingID/BookingNumber > 0100] EX)

The meaning of this condition is as follows:

A node element FlightBookingOrderConfirmation exists, to which the following applies: The content of the subelement BookingID/BookingNumber is greater than 0100.

More information: Using the Condition Editor

End of the example.

Note Note

For an expression of the form /A/B/C = G the getText() method that determines the content of this node is applied to the node <C>.

End of the note.