Start of Content Area

Function documentation Context Objects  Locate the document in its SAP Library structure

Use

Context objects are only relevant if you want communication to take place by using the Integration Server (A2A, B2B or Web-service oriented). A good alternative to XPath expressions, context objects enable you to access the content of messages during configuration in the Integration Directory. Take the following message instance as an example:

<InvoiceOut>

  <customerData>
     <address>
        <name> ... </name>
        <postalCode> ...</postalCode>
        ...
     </address>
     ...
  </customerData>
</InvoiceOut>

To access the content of the <postalCode> 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 <postalCode> 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 <postalCode> 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 ES 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 in integration processes, 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

Typing

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

...

Create a context object in the ES Builder (see: Creating an Object).

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

       2.      In the ES Repository, open the (service) interface to which you want to assign a context object. You can only assign context objects to the request message of interfaces in the same or in a superordinate software component version.

       3.      To assign context objects, proceed as follows:

       Imported RFCs or IDocs:
To assign the context object to a request message field, enter it in the Context Object column by using the input help. To undo the assignment of a context object, call the function list box in the input help for the field (This graphic is explained in the accompanying text) and choose
Reset (This graphic is explained in the accompanying text).

       Service Interfaces:
Select the relevant operation for assigning. Before you can assign a context object, a message schema must be assigned to the request message. If this is the case, select the name of the message and choose Context Objects. The ES Builder then displays the structure of the request message to enable you to assign a context object to the individual fields. To undo the assignment of a context object, call the function list box in the input help for the field (This graphic is explained in the accompanying text) and choose
Delete (This graphic is explained in the accompanying text).

Note

By assigning an operation a new message you can render an existing context object assignment invalid (because the relevant XPath expression no longer exists). To delete invalid assignments in all operations of the service interface, choose Check and Correct Context Object Assignments (This graphic is explained in the accompanying text). The check does not check whether the context objects you enter actually exist.

       4.      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 multiple (service) interfaces or operations.

 

 

 

 

 

 

End of Content Area