Entering content frame

Procedure documentation Using the Expression Editor Locate the document in its SAP Library structure

Use

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.

Procedure

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 relevant XSD data type (see also: Usable XSD Data Types).

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 are 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

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.

...

       1.      Select the required interface variable.

       2.      Define how the field is to be accessed:

¡        To use a context object, select the relevant context object.

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

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

If the field contains a structure, select Multiline.

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).

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

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

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.

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>.

 

Leaving content frame