cancel
Showing results for 
Search instead for 
Did you mean: 

sap xi

Former Member
0 Kudos

What is different between context object and xpath ?.

every one answered both same but i want clear information in realtime where is it used prorely?

Accepted Solutions (0)

Answers (5)

Answers (5)

former_member238007
Contributor
0 Kudos

Hi Sudhakar,

Context objects

Context objects are objects based on the XPath expressions.

Therefor they can be used to simplify the access to the content of a message.

By using XPATH we can able to access or refer the variable to check with the any type of boolean conditions, so if condition satisfies the data will be moved ..

. XPath expressions enable conditions to be evaluated depending on values in the payload [Extern]. Evaluations of this type are required for receiver determination in logical routing.

regards

Kishore

agasthuri_doss
Active Contributor
0 Kudos

Hi,

1) Context objects are a simple alternative to XPath expressions for accessing the contents of a

message. Take the following message instance as an example:

<InvoiceOut>

<customerData>

<address>

<name> ... </name>

<postalCode> ...</postalCode>

...

</address>

...

</customerData>

</InvoiceOut>

2) by XPath:

To access the content of the <postalCode> field, we would use the following expression in XPath:

/InvoiceOut/customerData/address/postalCode

3) by Context Object :

If we needed this expression in more than one condition, we would have to rewrite or copy it each time.

Instead, we can assign a context object to the <postalCode> field, for example with the name postalCode. we can then use the postalCode Context Object in all conditions where we need the value of the <postalCode> field, which makes the conditions easier to read.

4) A context object is scalar and has a reference type

Please go through the link

http://help.sap.com/saphelp_nw04/helpdata/en/d6/e44fcf98baa24a9686a7643a33f26f/frameset.htm

Regards,

sangeetha

Former Member
0 Kudos

Hi,

The Context Object we can use insted of Xpath. For your better under stand i can give you an example.

Suppose have to send a message with ClientID

<Record>

<Client>100</Client>

<Name>xxxx</Name>

</Record>

<Record>

<Client>200</Client>

<Name>yyyy</Name>

</Record>

If you create a context object to the <Client> then you can set the condition at Receiver Determination level. If <Client> 100 then the message goes to client 100. If <Client> 200 then the message goes to client 200.

If it is usefull award the points

Thanks,

Satish.

Former Member
0 Kudos

hi,

Context Objects

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:

<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 <postal Code> 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”

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

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. You can also use a context object in more than one interface.

Regards

Former Member
0 Kudos

Hi,

Difference between context object and x-path:

If u have multiple receiver system then to determine the reciever u can use context object.....

Context objects are alternative to XPATH expressions. It is like macros in other programming langugage. If you define this , you can use this object in the receiver determination while doing conditional receiver determination

xpath is the complete path of any field of the message structure.Xpath will give u total hierarchal structure of the field in message payload where as context path is like pointer to field.

Context object is a shorter mode of referring to the xpath. This is used when the field is under a deep heirarchy.

You can assign a XPATH to a CONTEXT OBJECT. It is like assigning a value to a variable. for example; Sting S = "you assign a XPATH to a CONTEXT OBJECT." and then further u can always use S anywhere instead of 'you assign a XPATH to a CONTEXT OBJECT.' Similarly, you can assign a xpath say root/a/aa/aaa/aaaa/aaaaa to a context object say fieldaaaaa.

Context object

To better idea see the blog...

/people/prasadbabu.nemalikanti3/blog/2006/09/20/receiver-determination-based-on-the-payload-of-input-dataextended-xpathcontext-object

Check out these also...

http://help.sap.com/saphelp_nw2004s/helpdata/en/d6/e44fcf98baa24a9686a7643a33f26f/content.htm

/people/prasadbabu.nemalikanti3/blog/2006/09/20/receiver-determination-based-on-the-payload-of-input-dataextended-xpathcontext-object

Here is a scenario where context objects were used for BPM

Get the details here:

http://help.sap.com/saphelp_nw04/helpdata/en/d6/e44fcf98baa24a9686a7643a33f26f/frameset.htm

Technical Context Objects :

http://help.sap.com/saphelp_nw04/helpdata/en/d6/e44fcf98baa24a9686a7643a33f26f/frameset.htm

A list of the Technical Context Objects names can be found here:

http://help.sap.com/saphelp_nw04/helpdata/en/6e/ff0bf75772457b863ef5d99bc92404/content.htm

XPath to show the path (Multiple Receivers)

/people/shabarish.vijayakumar/blog/2005/08/03/xpath-to-show-the-path-multiple-receivers

Customize your 'XPATH' Expressions in Receiver Determination

/people/shabarish.vijayakumar/blog/2006/06/07/customise-your-xpath-expressions-in-receiver-determination

Thanks

Swarup

Edited by: Swarup Sawant on Mar 20, 2008 12:09 PM

prateek
Active Contributor
0 Kudos

Both are not same. Context object is the reference to the complete path of a particular field whereas XPath is actually the complete path. It is better to use Context Object to simplify the developments

Regards,

Prateek