Powered By

Free XML Skins for Blogger

Powered by Blogger

Wednesday, August 6, 2008

Context Objects in SAP XI

Use

Context objects are a simple alternative to XPath expressions for accessing the contents of a message. Take the following message instance as an example:



...
...
...

...

To access the content of the field, you would use the following expression in XPath:

/InvoiceOut/customerData/address/postalCode

If you needed this expression in more than one condition, you would have to rewrite or copy it each time. Instead, you can assign a context object to the field, for example with the name postalCode. You can then use the postalCode context object in all conditions where you need the value of the field, which makes the conditions easier to read.

Comparison between XPath and Context Object

XPath

Context Object

/InvoiceOut/customerData/address/postalCode = “69120”

postalCode = “69120”

Note

Context objects encapsulate the XPath expression that you would otherwise use to access the field content.

Once you have created a context object in the Integration Repository and assigned a request message to the field, you can use it in the following situations:

· During receiver determination for a message, depending on its content

· During the processing of process steps, depending on the content of a message

There is a series of predefined technical context objects for accessing the header information of the message.

Features

Type Assignment

A context object is scalar and has a reference type. This means that you cannot assign context objects to structure fields. The reference type determines which type of values you will use later to compare the context object:

Context Object Data Types

Reference Type

Comparison Type

xsd:string

Lexicographical

xsd:integer

Numerical

xsd:date

Compare by date

xsd:time

Compare by time

Activities

...

1. Create a context object on the design maintenance screen of the Integration Builder (see: Creating a New Object).

2. Select a built-in XSD data type for your context object by using the Reference Type list box and save it.

3. Open the interface that you want to assign a context object to in the Integration Repository. You can only assign context objects to the request message of interfaces in the same or in a superordinate software component version.

4. To assign the context object to a request message field, enter it in the Context Object column by using the input help. For message interfaces, the structure of the request message is displayed on the Context Object tab page.

5. If you want to undo the assignment of a context object, select the name of the context object and choose Delete Context Object Assignment (This graphic is explained in the accompanying text).

6. Activate your changes.

Once you have activated your changes, you can use the context object in an integration process or to configure the field that you have assigned the context object to (see Expression Editor). You can also use a context object in more than one interface.

No comments:

Archives