Context Mapping for Non-Singleton Node

Hi ,
I have following context structure
Node_A
|     attr 1
|________ Node_B
                              attr2
                              attr3
Node_B is the child of Node_A.  NOde_B has attributes attr2 and attr3.
Node_B is a Non SIngleton Node.
Node_B is mapped to Node_View of the View Controller.
Node_A had 2 elements. Initially Element 1 is the Lead selection Element for Node A. I get the reference for Node_B using the Lead Selection Path
NodeA_element1 = Node_A->GET_ELEMENT( ). 
Node_B = NodeA_element1->GET_CHILD_NODE( 'NODE_B' ).
Node_B is filled with elements, lets say attr2 = 'Dallas', attr3 = 'Detroit'
Node_View shows the values Dallas and Detrait since its mapped to Node_B
Now the Lead selection of Node_A changes to 2.
I again gett he reference for NOde_B usign the Lead Selection Path (index 2)
NodeA_element2 = Node_A->GET_ELEMENT( ). 
Node_B = NodeA_element2->GET_CHILD_NODE( 'NODE_B' ).
Node_B is now filled with, lets say attr2 = 'Mexico', attr3 = 'Canada'
Since element 2 is Lead selection for Node A, now, and NodeB is mapped to Node_View, I expect the contents of Node_View to be attr2 = 'Mexico', attr3 = 'Canada' since this is along the Lead Selection of Node_A
But it stays attr2 = 'Dallas', attr3 = 'Detroit'
So in a nut shell,  the Context Mapping of the Non Singleton Node  DOES NOT map the Lead selection Path when its parent  , changes in Lead Selection.
Is this a BUG ?
Thanks

Hi Anand,
There is no bug. See when you are saying
"Node_B is now filled with, lets say attr2 = 'Mexico', attr3 = 'Canada' "
I am just not sure how you have filled the data in node B. Because the way u populate node data that way only you can get the data. The way you want to get data you must populate data in this way:
1. Get Node A instance let say in lv_node_A.
2. Get Node A element instance (lead selection) in your case lets say in lv_elem_A.
3. Now get node B instance by lv_elem_A->get_child_node( 'B' ) lets say in lv_node_B.
4. Create element of lv_node_B and bind it to the node B and also populate the value of attributes.
Repeat the steps as per your requirement. Also Singleton and Non singleton has nothing to do with this it is all about how the instances will be manged in the memory.
Look at this sample code and will help you while populating data in nested nodes:
    DATA lo_nd_a TYPE REF TO if_wd_context_node.
    DATA lo_el_a TYPE REF TO if_wd_context_element.
    DATA lo_nd_b TYPE REF TO if_wd_context_node.
    DATA lo_el_b TYPE REF TO if_wd_context_element.
    DATA ls_a TYPE wd_this->element_a.
    DATA lv_test LIKE ls_a-test.
    data lv_btest type string.
  navigate from <CONTEXT> to <A> via lead selection
    lo_nd_a = wd_context->get_child_node( name = wd_this->wdctx_a ).
  @TODO handle not set lead selection
    IF lo_nd_a IS INITIAL.
    ENDIF.
    data count type c.
    data count_i type i value 1.
    do 2 times.
      lo_el_a = lo_nd_a->create_element( ).
      lo_el_a->set_attribute(
      EXPORTING
        name =  `TEST`
        value = count_i ).
      lo_nd_a->bind_element( new_item = lo_el_a
                             SET_INITIAL_ELEMENTS = abap_false ).
      lo_nd_b = lo_el_a->get_child_node( 'B' ).
      lo_el_b = lo_nd_b->create_element( ).
      move count_i to count.
      concatenate count 'in node b' into lv_btest.
      lo_el_b->set_attribute(
      EXPORTING
        name =  `BTEST`
        value = lv_btest ).
      lo_nd_b->bind_element( new_item = lo_el_b
                             SET_INITIAL_ELEMENTS = abap_false ).
    count_i = count_i + 1.
    enddo.
This code will set value 1 and 2 in node A's test attribute. and on change of lead selection between 1 and 2 it will show value of attribute BTEST in node B as 1 in node B and 2 in node B...
Regards,
Neha

Similar Messages

  • Setting Node Attributes for a non singleton node

    HI,
    I want to know what is the correct way to set attributes for a non singleton node dynamically.
    I have node A which contains the non singleton node B.
    At runtime I want to change the attributes of node B dynamically. What is the correct way for this?
    When I try wdContext.nodeB().getNodeInfo I get a NullPointerException.
    For example this code works: wdContext.nodeA().getAElementAt(0).nodeB().getNodeInfo(). Here I get the node info.
    But when I set attributes for the second line, are there valid for all Elements in Node B?
    What is the correct way to set the attribut infos for non singleton Node B?
    Best regards,
    Peter

    Hi Peter
    The main rule here - do not touch node instances at all. Deal only with node metadata:
    IWDNodeInfo nodeBInfo = wdContext.getNodeInfo().getChild("node A").getChild("node B");
    nodeBInfo.getAttribute("xAttr");
    nodeBInfo.addAttribute(...);
    BR, Siarhei
    Edited by: Siarhei Pisarenka on Jan 13, 2010 12:55 PM

  • How to instantitate a non-singleton node

    I need to instantitate the non-singleton node which has the following properties
    Collection cardinallity of 0..n
    and
    Selection Cardinallity of 0..1
    But when I try to get this node using wdContext.nodeA().nodeB()
    where
    nodeA is singleton
    nodeB is non-singleton whose properties are given below
    I always get nodeB as null . it seems nodes are initialized only if set to singleton
    I need non-singleton node for using the TableRowGrouping element
    If any one can please help that will be great

    Hi Gaurav,
    You have not mentioned nodeA  properties.If it's cardinality is 1..x then no need to initialize A otherwise you must initialize A first then initialize nodeB.
    Try like this:
    //If  cardinality of A is not 1...1
    IPrivateTrstView.IAElement ele = wdContext.createAElement();
    //Set if there are any attributes
    ele.setXXX();
    wdContext.nodeA().addElement(ele);
    IPrivateTrstView.IBElement ele = wdContext.createBElement();
      ele.setXXX();
    wdContext.nodeB().addElement(ele);
    The singleton property refers the relationship between the node and its parent but not between the node its child as for as I know.
    Regards,
    Siva

  • External context mapping issue: cannot create nodes,no mapping defined yet

    Hello everybody,
    I'm trying to use the external context mapping as it is explained in http://help.sap.com/saphelp_nw04/helpdata/en/d7/e551cf896c3a49bb87bb4ce38c99c8/frameset.htm
    I did it in the past without any problem, but now, when i try to create a new node, i get the error "cannot create nodes,no mapping defined yet." This error appears as i try to create an element of the node (in the Internal Component), this way:
         IPruebaNodoElement elto = wdContext.nodePruebaNodo().createPruebaNodoElement();
         elto.setPrueba("Esto es una prueba");
         wdContext.nodePruebaNodo().addElement(elto);
    The mapping is correctly done in the "Embedder Component", and the attribute "isInputElement"=true in the Interface Controller of the "Internal Component".
    Any idea, any clue?
    Thank you very much in advance
    Isidro López

    Frankly speaking: I just read again, but very carefully, all the steps explained at
    http://help.sap.com/saphelp_nw04/helpdata/en/d7/e551cf896c3a49bb87bb4ce38c99c8/frameset.htm.
    Read it carefully and try to implement that example, that could be really helpful.

  • Context mapping for Interactive ADOBE form

    I could able to create the form context from the web dynpro context. I am stucked at mapping between the two contexts.
    When I insert the element Interactive form in the layout of Web Dynpro and specify the template source,
    We have the option of  automatically generate the context from form interface and binding form object to the
    This context. But I got stucked at the point of mapping between the two. The structure is not appearing in the web dynpro context after mapping. Can anybody tell is there any procedural error or any configuration is required?

    For further questions, check the follow
    https://www.sdn.sap.com/irj/sdn/adobe
    Improving the Performance of Adobe® LiveCycleu2122 Designer Forms(scripting)
    http://www.adobe.com/devnet/livecycle/articles/lc_designer_perf_guidelines.pdf
    Interactive Forms Based on Adobe Software: Overview
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/e635e290-0201-0010-a9be-9e8e4ce04770
    Adobe Interactive Forms
    http://www.saplounge.be/Files/media/pdf/Huberland-Interactive-Forms-2007.10.10.pdf
    Taking interactive forms to next level
    https://www.sdn.sap.com/irj/sdn/go/portal/prtroot/docs/library/uuid/8c103c36-0301-0010-cda8-f6b381bedb6e
    Introduction to Adobe PDF Library SDK(PDFL SDK)(Simply scroll the document)
    http://partners.adobe.com/public/developer/en/webseminars/PDFL_WebSeminar.pdf
    Creating Interactive forms in webdynpro for java
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/docs/library/uuid/5f27e290-0201-0010-ff82-c21557572da1
    PDF-Based Print Forms/SAP Interactive Forms by Adobe
    http://help.sap.com/saphelp_nw04s/helpdata/en/c8/4adf7ba13c4ac1b4600d4df15f8b84/frameset.htm
    Date Objects in Adobe Designer
    http://help.sap.com/saphelp_nw04/helpdata/en/dd/60694fddb74ad88cdb7d2a094f3dd2/frameset.htm
    Checking and Testing a PDF-Based Print Form
    http://help.sap.com/saphelp_nw04s/helpdata/en/c2/1fe9aa4d7b413e8515f90b73729e97/frameset.htm
    Architecture
    http://help.sap.com/saphelp_nw04/helpdata/en/f2/21021b911f4c0cae11459a4ce0bc62/frameset.htm
    http://www.nl4b.com/Adobe/Invitation_SAPBrussels_Q407.pdf

  • When a context node use non-singleton, how to invoke the supply funtion eve

    when a context node use non-singleton, how to invoke the supply funtion everytime the lead selection is changed ?

    Hi wei,
    <b>Non-singleton nodes:</b>
    Web Dynpro allows you to define non-singleton nodes. Each non-singleton node has one node instance for each node element of the parent collection at runtime. The advantage is that each instance can be accessed directly. When using non-singleton nodes, the nodes are only created when the node values are retrieved. This can save resources that otherwise would slow down the performance of the application.
    <b>Supply function:</b>
    The Web Dynpro tools also automatically enhance the corresponding controller class with a supply function including the user coding area contained in it
    Supply functions are implemented as methods of type
    <b>public void supplyChildNodeElements(SomeChildNode node,
                                        SomeParentNodeElement)</b>
    in a Web Dynpro controller (view controller or custom controller). Supply functions and context nodes have a 1..1 relationship, that is, supply functions are specific for individual context nodes. Under certain conditions, supply functions are called by pages in the Web Dynpro runtime environment.
    Hope this helps u,
    Regards,
    Nagarajan.

  • Singleton node and non singleton practical scenario

    Hi  Friends,
    Iam totally confused with singleton and non singleton node implementation please explain practical implementation on singleton and nonsingle ton node . In which scenario  non single ton node is used.
    Thanks in advance
    Prasad

    Hi,
    Singleton Node:
    A singleton node contains only one instace of the node at runtime. And that instace contains multiple elements at runtime.
    By default if we create a node under ROOT context node, it will be allways singleton true.
    Non singleton node:
    A non singeton node contains more then one node instance at runtime. And each instance contains multiple elements at runtime.
    It is not possible to create NonSingletonNodes directly under ROOT context node. We can create under any node which is under ROOT context node.
    Note: In terms of datastorage at runtime we can say if node is table then each elment of node instance is a row of that table.
    When is it requried to create non singleton nodes?
    For example if you have list of SalesOrders and each and every oder is having list of items. Then we can create this node structure in two ways:
    Orders (singleton true)
    > Items (singleton true)
    Here in this case at any point of time the there will be only one instance of Items node exist for currently selected element of Orders node. And that instance contains multiple elements nothing but items of that order.
    Orders (singleton true)
    > Items (singleton false)
    Here in this case at any point of time all the instances of Items node exist for all the elements(not only for currently selected element) of Orders node. And those instances contains multiple elements nothing but items of those corresponding orders.
    I hope it helps.
    Regards,
    Vijay K

  • Mapping deploy for Non-Oracle Data Source hangs

    Hi All,
    I am trying to deploy mapping for Non-Oracle Data Source and it hangs.
    Oracle version is 10.2.0.3 and OWB version is 10.2.0.1.3.1
    It would be really appreciated if you can help.
    Thanks!
    PS.

    That helpes quite a bit. I still can't get the app to retrieve data, but I am getting a more useful message in the log:
    [Error in allocating a connection. Cause: Connection could not be allocated because: ORA-01017: invalid username/password; logon denied]
    As you suggested, I removed the <default-resource-principal> stuff from sun-web.xml and modified it to match your example. Additionally, I changed the <res-ref-name> in web.xml from "jdbc/jdbc-simple" to "jdbc/oracle-dev".
    The Connection Pool "Ping" from the Admin Console is successful with the user and password I have set in the parameters. (it fails if I change them, so I am pretty sure that is set up correctly) Is there another place I should check for user/pass information? Do I need to do anything to the samples/database.properties file?
    By the way, this is the 4th quarter 2004 release of app server. Would it be beneficial to move to the Q1 2005 beta?
    Many thanks for your help so far...

  • Recursive node and Non Recursive node

    Hi,
    What is the difference between Recursive node and Non Recursive node ?
    Thanks,
    Teja

    Hi Teja
    Recursive node
    If you wish to represent a recursive data structure within the context, a recursive node is the correct node to use. The simplest example of recursive data within a hierarchical structure is a file system. A dictionary can contain either files or subdirectories. This definition is then repeated for each subdirectory level down the hierarchy.
    Within the context, a recursive node is a special node that has only two properties: name and repeatedNode. As with any context node, a recursive node must itself name, but the repeatedNode property is where the recursion is defined. This property holds a reference to some parent node and indicates that, at runtime, the location of the recursive node will be occupied by a node of the type indicated in the repeatedNode property.
    You should think of a recursive node as a design time placeholder used to indicate a node will be created at this location at runtime, and will be of the type named in the repeatedNode property.
    The node name identified by repeatedNode must lie on the direct path back to the context root node.
    When a recursive node is created at runtime it always created as a non-singleton node. This is a hard-coded feature and cannot be changed.
    Non recursive node is opposite to recursive node
    Regards
    Ruturaj

  • Need Help in Context Mapping

    Hi,
    I am having two components.
    Comp A  is main componenet  and Comp B is Used component and using in Comp A.
    Intially I am getting the data from the Comp A ( main Comp) to Comp B(used Comp) by context mapping.
    it is working fine.
    The same way I need in Reverse. From Comp B (Used Comp) to Comp A (Main Comp) i have to get the data .
    how to do context mapping for this.
    pl help.
    Thanks in Advance.
    Kar

    Hi,
    To achieve reverse (external) context mapping, the attribute 'Input Element' in interface node of component B has to be marked. When you declare a component usage of component B in your component A, you will see the interface node under Component Usages->Interface Controllers (in your navigation tree). You can define the mapping here, between the 'Input element' node of component B and the component controller Node in comp A by right click->Define external context mapping.
    Have a look at the [documentation |http://help.sap.com/saphelp_nw04s/helpdata/en/67/cc744176cb127de10000000a155106/frameset.htm] in detail.
    You can have a look at the ALV component SALV_WD_TABLE, which uses external context mapping to render the ALV in any component using this component. This will give you a good idea.
    Regards,
    Nithya

  • Context Mapping in web dynpro

    Hi,
    Steps which I underwent for context mapping is:
    1. Opened view designer for start view .
    2. Choose the context tab.
    3. Opened the context menu for the root node context n choosed the option New->Value attribute.
    4. entered the name for the attribute such as name n choosed finish.
    5. From the context menu for the attribute Name choose Edit Context Mapping.
    Problem is in my case "edit context mapping" is disable.
    Regards

    Hi
    u have to add the Component Controller In the required Controllers List of the view
    thwn u fill find the it enabled.
    Suppose u want to map the value Attribute in the view to that of the Attribte in the Component Controller then add that ComponentContolle Name in the required Controllers of the view
    ur Component controler shuld also have the Value Attribute of same data type.
    u can go properties of the View there u have required Controllers and Add Button click on that and add ur controller Name

  • Problem with CrossComponent Context Mapping with PopupWindow (web dynpro ab

    The situation:
    I have four views (View V1, V2, V2_popup, V3) in three Components C1, C2,C3.
    View V1 is embeded in Component C1. View V2 is embeded in C2 with view V2_popup as Popup-Window.
    View V3 is embeded in Component-C3. And at last the View of Component C2 and C3 are embeded in View V1.
    The Problem is the CrossOver Context Mapping between the view V2 and V3.
    My first way is the "direct context mapping":
    I define a node in the ComponenteControllen from Component-C2 as interface and use it over the ComponentenController
    from Component-C3 in view-V3. Now I bind an attribute of the mapped node to an ui-element (e.g: inputfield),
    but the output of the Field is empty.
    The second way is, that I define an external Mapping for this situtation.
    I define a node in the componente-controllen from Component-C2 (an Component-C3)as interface with the attribute "Input Element (Ext)".
    Than I map the two nodes with a node from Component-C1. That's works fine.
    BUT, if I execute an action (e.g. action_save)in the popup for view-v2 (V2_popup) the changings from the inputfields don't write (show)in the context of the
    popup-view. I check this with the debugger. And if I close the popup and open it again, the changings are visible.
    Short: If I define a node with attribute "Input Element (Ext)", I don't can read changings from
    the screen in a popup-window.
    How I can solve this problem???
    Message was edited by:
            Maik Sturm

    Hi Maik,
    try this:
    at first you have to instantiate all! used components in the wddoinit method of the componentcontroller in your main (c1) component.
    e.g. instance of c2 Component
      lr_usage_c2_comp =   wd_this->wd_cpuse_c2_comp( ).
      IF lr_usage_c2_comp->has_active_component( ) IS INITIAL.
        lr_usage_c2_comp->create_component( ).
      ENDIF.
    and at the end set the reference:
      l_ref_interfacecontroller =  wd_this->wd_cpifc_c3_comp( ).
      l_ref_interfacecontroller->set_usage(
        ir_usage_c2_comp = lr_usage_c2_comp ).
    set_usage is a method in the c3 component controller,
    METHOD set_usage .
      DATA: lr_usage TYPE REF TO if_wd_component_usage.
      lr_usage = wd_this->wd_cpuse_c2_comp( ).
      lr_usage->enter_referencing_mode( ir_usage_c2_comp ).
    After doing this the components are using the same instance and you can simply use direct mapping between the components.
    Hope it helps.
    regards
    Christian

  • Mapping for ND_FORM to ND_FORM not possible due to recursion

    Hi Experts,
    I am trying to define external context mapping...with the steps..say there are two components ZOMP1(in which i am using other component) and ZCOMP2(this is used in zcomp1)
    1. IN the component zcomp2  I define ZCOMP1 under the used components
    2.in the component controller of ZCOMP2 under properties tab I create controller usage of zcomp1 and two entries are created
    3.I go to the context tab of component controller of zcomp2 and drag and drop the ND_FORM  node from ZCOMP1 to context node of ZCOMP2
    when I do a check I get the error
         Mapping for ND_FORM to ND_FORM not possible due to recursion
    Don't understand why am I getting this error though the node I am trying to map is not recursive?
    This is what I see in long text of error:
    Message no. SWDP_WB_TOOL263
    Diagnosis
    Mapping from ND_FORM to ND_FORM is not permitted, as ND_FORM has its own mapping that refers directly or indirectly to ND_FORM.
    System Response
    The mapping can neither be created nor used.
    Procedure
    If you receive this error message when you check a context or when you update the mapping to context node ND_FORM, delete the mapping to ND_FORM using the context menu function with the same name.
    Please help,
    Anubhav

    Hi Anubhav,
    following restrictions apply on recursion nodes:
    1. You cannot nominate a recursive node to act as the data source in a context mapping relationship. Recursive node structures are restricted to the scope of a single controller.
    2. The root node of a context cannot be used for a recursion.
    Please check this...
    http://help.sap.com/saphelp_nw04s/helpdata/en/47/45641e80f81962e10000000a114a6b/content.htm
    Also Cehck This,..
    Enhancement FPM of Trip application
    Cheers,
    Kris.

  • Doubt in external context mapping

    Hi,
    whiel practicing the external context mapping exmaple i read the following lines in the PDF file
    "At design time, a Web Dynpro component does not know the context structures of its
    embedding Web Dynpro component. Therefore, it is not possible at design time to map
    context elements in the component interface controller of Web Dynpro component A to
    context elements that belong to a controller context of Web Dynpro component B, which has
    declared a usage of A. However, if Web Dynpro component A itself uses another Web Dynpro
    component within itself, this is possible (general context mapping)."
    I could not understand the difference between the second and the third lines Can any one let me know if at all there is any difference? Also i would want to know the reason behind such restriction as to y the parent cant red the context of the child component?
    Also can any one let me know the reason y cant we do the external context mapping for the attributes of the root node?

    Hi P K,
    What the lines you mentioned is trying to say is that -
    The Context of an Controller in WD Development Component can only be mapped to Component Controller/View Controller/Custom Controller/Interface Controller of its own WD DC as general context mapping but it wound not be possible for the Controller of DC 1 (other than Interface Controller) to be mapped in design time to the Component Controller/View Controller/Custom Controller of some other DC 2 which has DC 1 as used component (which is known as external mapping). DC 1 can interact with some other DC 2 only through interfaces. So, if DC 1 is put as Used DC for DC 2 then, you can only map and use methods (i mean access) of the DC 1 in DC 2 through Interface Controllers. Rest of the Controller contexts/methods of DC 1 is not readable by DC 2.
    Regards,
    Tushar Sinha

  • Can we call singleton node as a child node?

    Hi all, after reading the links i am not that much clear what i ahve understand is that non singleton node means parentnode? and singleton node means child node? but i want to know if i create two nodes emp and dept and emp node i will make as a singleton and dept will be normal then how the relationship

    malcolmmc wrote:
    BigDaddyLoveHandles wrote:
    Rather than building a better mouse trap, why not ditch the singleton? It's a bad design choice.The alternative tends to be having some global configuration block which gets propagated to just about every object on the system. You can hide it behind stuff like JNDI contexts etc. but these aren't really more "pure OOP" than singletons.Yah pays yer money and takes yer chances. I like the Spring approach. No JNDI there, and while I didn't bring up OOPurity, it seems purer to me. It's easy to get rid of a Singleton and replace it with either an implementing object or a test mock. Sw33t.

Maybe you are looking for

  • My eMac seems to be dieing...

    Here are the problems I am having: *Really really really slow* -Over the years it has got noticeably slower than it used to be. I used to use it for video editing, but it got slow after I stopped. We can't run some programs it used to run fine becaus

  • Can I back up what I want to keep on an external hard drive, as far as apps,pictures, books etc, and then delete the entire iCloud ?

    Can I back up apps, books, etc to an external hard drive and delete iCloud?

  • Decimal places in Pur docs - URGENT

    Hi We have requirement in our project where we need to accomodate 4 decimal places in the PRICE field instead of the 2. For example we load an item from catalogs or external supplier site, where the price is 75.3492 the price gets rounded off to 75.3

  • Nexus 5010P-BF does not load system image

    Hi experts, We have a N5K-C50510P-BF. When these nexus starts that didn't booting any further than the kickstart. Here's the boot sequence log User break into bootloader Loader Version pr-1.3 loader> loader> boot bootflash:n5000-uk9-kickstart.5.2.1.N

  • Load Data to Hierarchy

    Hi, I have mainted the Cost Center Hierarchy in SAP, I see Hierarchies & Master Data transfared from SAP to BW I see that The Hierarchy is defined very well My problem is some values transferred to BW but falls under 'unassigned' Whay should I check