Skip to Content
author's profile photo Former Member
Former Member

Context Handling and User defined Functions

Hi everybody,

This forum is assisting me a lot to learn about XI & regards to all

people who contributed good answers to my questions.I have some doubts plz clarify if possible

1.what is context handling and in which cases we go for context handling?

2.what are user defined functions and how to write user defined functions any sample codes ?

3.Is it possible to build sync-async bridge ? if so how ?

Plz answer to this questions good answers will be rewarded .

Regards,

Smitha.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

7 Answers

  • Best Answer
    Posted on Jul 11, 2007 at 06:52 AM

    Hi Smitha,

    <i>1.what is context handling and in which cases we go for context handling?</i>

    XML contains some nodes and they follow some hierarchy. The level of a particular node in the hierarchy can be deremined by the context of the node in the hierarchy. Context handling is a technique where we use for manipulating these nodes and their hierarchy in the XML file/tree.

    There are some standard given function to handle these kind of context handling issues.

    For more information...

    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/0f6991e5-0901-0010-e0b0-dc2a26cc0389

    Just check this one also...good blog on context handling...

    /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping

    <i>2.what are user defined functions and how to write user defined functions any sample codes ?</i>

    In order to create UDFs, you need to have a basic idea about using Core Java. Also, based on the kind of functonality of the code, you will need to know if you require any extra jar files.

    To create a UDF, all you need to do is click on LHS icon in the graphical mapping editor. Also, keep in min that the input and otput of a udf is always in strings.

    To test your functions, you can either use the test tab present in the mapping editor or you can even use the following editor(blog by Sravya):-

    /people/sravya.talanki2/blog/2006/07/24/integrating-java-editor-in-xi-integration-stack

    I think info will be enough for you to start off with creating and using UDFs:)

    Also, since you are an ABAPer, you might be interested in this blog which discusses how to use the ABAP editor to create, modify and test java programs!:-

    /people/vijayasarathy.raghunathan/blog/2005/12/28/java-editor-inside-abap

    3.Is it possible to build sync-async bridge ? if so how ?

    Sync/async communication enables a synchronous sender system to communicate with a receiver system that cannot process synchronous messages

    Refer this blog

    /people/ravikumar.allampallam/blog/2005/02/17/bridging-the-sync-async-bridge-with-fork-xi

    /people/sriram.vasudevan3/blog/2005/01/11/demonstrating-use-of-synchronous-asynchronous-bridge-to-integrate-synchronous-and-asynchronous-systems-using-ccbpm-in-sap-xi

    There is an example of the Sync/Async Bridge in th SWCV: SAP BASIS.

    Namespace: http://sap.com/xi/XI/System/Patterns

    The Integration Server receives synchronous messages from a sender and send them to a receiver as asynchronous messages. Conversely, it can send the asynchronous response from the receiver back to the sender as a synchronous response.

    As soon as a synchronous message is received from the sender system the process uses a special receive step to open the sync/async bridge, sends the received message to the receiver system asynchronously, and waits for the asynchronous response to arrive from the receiver.

    The BPE receives the asynchronous response from the receiver, correlates it with the corresponding query, and activates the waiting process, which then sends the response back to the sender synchronously.

    This blog also should give you some idea...

    https://www.sdn.sap.com/sdn/weblogs.sdn?blog=/pub/wlg/1403 [original link is broken] [original link is broken] [original link is broken] [original link is broken]

    Also go through these links:

    http://help.sap.com/saphelp_nw04/helpdata/en/83/d2a84028c9e469e10000000a1550b0/frameset.htm

    http://help.sap.com/saphelp_nw04/helpdata/en/c4/dc06418752ef6fe10000000a1550b0/frameset.htm

    http://help.sap.com/saphelp_nw04/helpdata/en/f9/66bf40ad090366e10000000a1550b0/RN_XI_DE_neu.pdf

    Cheers...

    Vasu

    <b>** REward POints if found useful **</b>

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 05:05 AM
    10

    Hi Smitha

    <i>

    1.what is context handling and in which cases we go for context handling?</i>

    -


    >

    Lets take example. Look at below hierarchy.Record node contains Item node that contain Amount element

    Records

    -


    >Item

    -


    >Amount

    Now suppose in the target you want to have sum of all Amount in the record. So this you can achieve by changing context of Amount to Records rather than Item. So that you can have all Amount(s) in same context and hence you can use 'sum' function from Statistics function group in graphical mapping.

    In short <i>context change is nothing but a value gets put into the next instance of its parent</i>

    Refer these blogs.They are really worth to understand context handling

    /people/riyaz.sayyad/blog/2006/04/23/introduction-to-context-handling-in-message-mapping

    /people/claus.wallacher/blog/2006/04/17/replication-of-nodes-using-the-graphical-mapping-tool

    Add a comment
    10|10000 characters needed characters exceeded

  • Posted on Jul 11, 2007 at 04:10 AM

    Smitha,

    <i>what is context handling and in which cases we go for context handling?</i>

    Context handling is nothing but changing ur contexts in the source in order to achieve the target results. I'll explain it with an simple example.

    Let say my source is

    <MT_OB>

    <Records>

    <Dealer code =1234>

    <No_of_purchase>123</No_of_purchase>

    </Dealer>

    <Dealer code =1233>

    <No_of_purchase>12</No_of_purchase>

    </Dealer>

    <Dealer code =12434>

    <No_of_purchase>1</No_of_purchase>

    </Dealer>

    <Dealer code =123134>

    <No_of_purchase>23</No_of_purchase>

    </Dealer>

    </MT_OB>

    </Records>

    In my target I need

    <MT_IB>

    <Record>

    <Total_No_Of_Purchase/>

    </Record>

    </MT_IB>

    So Basically u have to count all the from the source.So wht we can do Change the context of Records level and u can use Statistic funtion SUM in order to achieve the same.

    Does the above example, make sense? If you need any further clarification let me know.

    Best regards,

    raj.

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 05:53 AM

    Hi Smita I have got a lot of material regarding the same if u could send me ure email address i can send it accross.

    Context handling is basically to do with handling of Queue in mapping

    for a small eg

    i have the source as

    <MT_DATA>

    <Node>

    <Amt>20</Amt>

    </Node>

    <Node>

    <Amt>20</Amt>

    </Node>

    If i use the sum statistics function normally on the Amt tag u wil get only 20

    But if u change the context of Amt to the higher level as <MT_DATA>

    then the value of the sum will be 40.

    U can change context and veiw the queue by rigth clicking on the element.

    Regarding Async - Sync Bridge it is possible only using BPM

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 04:08 AM

    hi,

    context object is a generic term used to make a reference to message heder fileds in the XML file (also vth XPATH). Context of an element is nothing but just the level (with reference to its parent node) where the XML tag appears in the given XML document.

    for more info go to,

    <a href="/people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i:///people/sravya.talanki2/blog/2005/08/16/message-mapping-simplified--part-i

    https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3bwww.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3b">https://www.sdn.sap.comhttp://www.sdn.sap.comhttp://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/f59730fa-0901-0010-df97-c12f071f7d3b>

    Regards

    R.Ragu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 04:25 AM

    Hi,

    Further Infor User Defined Functions

    http://help.sap.com/saphelp_nw2004s/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htmhttp://help.sap.com/saphelp_nw2004s/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/d9/718e40496f6f1de10000000a1550b0/content.htm>

    <a href="/people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio:///people/stefan.grube/blog/2005/12/30/test-user-defined-functions-for-the-xi-graphical-mapping-tool-in-developer-studio

    <a href="/people/harrison.holland5/blog/2006/12/08/mapping-context-changes-in-xi:///people/harrison.holland5/blog/2006/12/08/mapping-context-changes-in-xi

    http://help.sap.com/saphelp_nw2004s/helpdata/en/4b/a20c4cfea96b498b1e1af3f32f0670/frameset.htmhttp://help.sap.com/saphelp_nw2004s/helpdata/en/4b/a20c4cfea96b498b1e1af3f32f0670/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/4b/a20c4cfea96b498b1e1af3f32f0670/frameset.htm>

    <a href="/people/venkataramanan.parameswaran/blog/2007/02/06/is-there-a-possibility-to-access-xi-standard-functions-in-user-defined-functions-yes:///people/venkataramanan.parameswaran/blog/2007/02/06/is-there-a-possibility-to-access-xi-standard-functions-in-user-defined-functions-yes

    Regards

    R.Ragu

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jul 11, 2007 at 04:06 AM

    Hi Smita ,

    Context Handling

    Context handling you use when you want to group elements in different node from source into the single node of target with multiple occrance of element( remove context) and if you want to do rever of it the use function split by value .

    For more details refer following blog

    /people/sravya.talanki2/blog/2005/12/08/message-mapping-simplified-150-part-ii

    User defined fuction

    You can write simple or advance user defined functions in your mapping prgm and do all the manupulation . You can use simple , context or queue type of data in it .

    Sample UDF which formats date

    /*

    Returns time in required format with milliseconds

    */

    java.util.Date d = new java.util.Date();

    java.text.SimpleDateFormat f

    = new java.text.SimpleDateFormat("yyyy-MM-dd HH:mm:ss.SSS");

    return f.format(d) ;

    Sync Async Bridge

    Refer following blogs .

    Use of Synch - Asynch bridge in ccBPM

    /people/sriram.vasudevan3/blog/2005/01/11/demonstrating-use-of-synchronous-asynchronous-bridge-to-integrate-synchronous-and-asynchronous-systems-using-ccbpm-in-sap-xi

    https://www.sdn.sap.com/irj/sdn/weblogs?blog=/pub/wlg/1403 [original link is broken] [original link is broken] [original link is broken] [original link is broken]

    Thanks ,

    Suvarna

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.