Add several elements to a node

Hello experts,
I'm trying to add several elements to a node I have, the node cardinality is 0..n and the data I'm trying to pass comes from a hashtable, this is the code I have:
ICifrasControlElement cifras = wdThis.wdGetContext().createCifrasControlElement();
for(;enum.hasMoreElements();){
String key = (String)enum.nextElement();
String value = (String)res.get(key);                    
cifras.setConcepto(key);
cifras.setValor(value);
wdContext.nodeCifrasControl().addElement(cifras);
I'm getting this exception:"cannot bind or add element, because it is already bound to a node"

Jesus-
Your problem is you have created only one element and you are adding the same reference in the loop. Change your code as follows:
for(;enum.hasMoreElements();){
String key = (String)enum.nextElement();
String value = (String)res.get(key);                    
ICifrasControlElement cifras = wdThis.wdGetContext().createCifrasControlElement();
cifras.setConcepto(key);
cifras.setValor(value);
wdContext.nodeCifrasControl().addElement(cifras);
Cheers-
Atul

Similar Messages

  • Add an element to a node.

    Hi,
    Any help to add an element to a node.
    I have a node in a view context and I would like to add its content to a component controller context node which has the same structure ( subnodes and attributes) .
    Thanks in advance.

    Hi,
    Sorry , i think i misspoke. I'll try to be clearer.
    It's as simple as you have a registration screen of a game. and then players must register one by one in the same screen.
    So you have the same screen with the same structure behind and each time when a player press submit button after its registration you add a new entry in the table and clear all fields of the same screen for the next player.
    I want to do some thing like a table of node in the component controller.
    For this i just use a main node with cardinality 0..n.
    Then in each view i have the same node structure that i use.
    When the user press submit i want to add all what he has filled-in as a new entry in the principal node in the component controller context. And then pass to the next view which use the same structure.
    Here is the wrong code in the submit method to have an idea
    method ONACTIONSUBMIT .
    **   prepare Usage table
      DATA: lo_node_1 TYPE REF TO if_wd_context_node.
      DATA: l_prop_usage_tab  TYPE STANDARD TABLE OF bapi1077du,
            l_prop_comp_tab TYPE STANDARD TABLE OF bapi1077vp.
      DATA :  lo_component TYPE REF TO if_wd_component,
              lo_context TYPE REF TO if_wd_context,
              lo_controller TYPE REF TO if_wd_controller,
              lo_node TYPE REF TO  if_wd_context_node,
              lo_child TYPE REF TO if_wd_context_node.
      lo_component = wd_comp_controller->wd_get_api( ).
      lo_controller ?= lo_component.
    * get controller context node
      CALL METHOD lo_controller->get_context
        RECEIVING
          context = lo_context.
    * get root node component controller
      lo_node = lo_context->root_node.
    * get prop_component node of component controller
      lo_node = lo_node->get_child_node( 'GENERAL_COMPO' ).
      DATA lo_element type ref to IF_WD_CONTEXT_ELEMENT.
      lo_node_1 = WD_CONTEXT->get_child_node( name = 'GENERAL_COMPO' ).
      lo_element = lo_node->create_element( STATIC_ATTRIBUTE_VALUES = lo_node_1 ).
      lo_node->BIND_ELEMENT( new_item = lo_element set_initial_elements = abap_false ).
    *  lo_child = lo_node->get_child_node( 'COMPOSITION' ).
    *  lo_child->BIND_ELEMENT( l_prop_comp_tab ).
    *  lo_child = lo_node->get_child_node( 'USAGE' ).
    *  lo_child->BIND_ELEMENT( l_prop_usage_tab ).
    endmethod.
    General_comp is the main node. it is with 0..n cardinality in the controller context.
    And with 1..1 cardinality in the view context and there is no mapping between them.
    It contains 2 sub-node "usage" and composition.
    Hopefully it is clearer
    Thanks for help
    Edited by: dyngry on Apr 21, 2011 9:31 AM

  • Can't add new element to model node from web service

    Hi Folks,
    we are using the old WebService (not adaptive one) for calling a service on XI. We are reusing the same service for loading the data and also sending them back to the backend to modify, delete or add new elements. Request and response tree structure consist basically of the same structure.
    Now everything works fine so far except adding a new element to the model tree.
    So what are we doing:
    After calling the service for reading (and invalidate on the response), we copy the received data from response node into the request node. All the view forms are bound to the model elements in the request.
    Modifying single attributes worked just fine (from dialog and programatically). A new element we add to the model tree shows up in the dialog and seems to work equally fine, but when we trigger the service call to send the collected data, every change to the model data is send except the new added element. It just won't be send.
    What's the problem here? Seems to me this must be somehow related to the supplying relation role maybe.
    What code do you need to look at and how do I mark code in the new forum editor so it gets displayed properly formatted?
    Thanks,
      ok

    Hi,
    Can you tell me which code are you using currently for transferrring the data? It might help me to figure out what your problem is.

  • How can i add selected element from one node to other node

    Hi All
    I have below requirement.
    Say In the view leftside Available Languages ItemList Box  Rightside Available Languages ItemList Box and Add & Remove Buttons in the middle.
    User selects languages from Available Languages ItemList Box clicks on add it will adds to the Available Languages Item List box and ViceVersa with Remove Button.
    1) I have created 2 nodes 1) AvlLang 2) SelLang both contains two attributes Key and Value.
    2) For AvlLang node,  Property : Data Dictonary binded with table. Values are coming fine in Available Languages ItemList Box.
    3) How can i add selected language into the node Available Languages.
    Please provide the code snippet how to achieve this.
    BR
    X- CW

    Hi Carlin,
    Find below code to copy selected record from one node to another.
    Here I am copying it_lips node into pack_mat node.
    DATA: wa_temp TYPE REF TO if_wd_context_element,
                lt_temp TYPE wdr_context_element_set,
                count type c.
          DATA : lo_nd_it_lips TYPE REF TO if_wd_context_node,
                 lo_el_it_lips TYPE REF TO if_wd_context_element,
                 ls_it_lips TYPE wd_this->Element_it_lips,
                 lt_it_lips TYPE wd_this->Elements_it_lips,
                 ls_unpack TYPE wd_this->Element_unpack,
                 lt_unpack TYPE wd_this->Elements_unpack.
    * navigate from <CONTEXT> to <IT_LIPS> via lead selection
          lo_nd_it_lips = wd_context->path_get_node( path = `ZRETURN_DEL_CHANGE.CHANGING_3.IT_LIPS` ).
          CALL METHOD lo_nd_it_lips->get_selected_elements
            RECEIVING
              set = lt_temp.
    * navigate from <CONTEXT> to <PACK_MAT> via lead selection
          lo_nd_pack_mat = wd_context->get_child_node( name = wd_this->wdctx_pack_mat ).
          LOOP AT lt_temp INTO wa_temp.
            CALL METHOD wa_temp->get_static_attributes
              IMPORTING
                static_attributes = ls_it_lips.
                  ls_pack_mat-vgbel = ls_it_lips-vgbel.
                  ls_pack_mat-vgpos = ls_it_lips-vgpos.
                  append ls_pack_mat to lt_pack_mat.
                  CLEAR ls_pack_mat.
          endloop.
            lo_nd_pack_mat->bind_table( new_items = LT_PACK_MAT
                                        SET_INITIAL_ELEMENTS = abap_true ).
    Cheers,
    Kris.

  • How can I add an attribute to a node?

    Hi,
    How can I add an attribute to a node of a DOM Document?
    I want to add attribute Maximum="6" for all Grade node as <Grade Maximum="6">.
    Grade is a third level node in my document.
    Thanks

    Hi,
    How can I add an attribute to a node of a DOM
    Document?
    I want to add attribute Maximum="6" for all Grade node
    as <Grade Maximum="6">.
    Grade is a third level node in my document.
    ThanksGet the father of "Grade" elements as an element. Then get all elements named "Grade", and for each one set attribute "Maximum" with value "6". If you read api documentation you will know which methods to use.
    But for helping you in getting the "Grade" parent.
    1) get the root element of the Dom Doc
    2)get the father of the "Grade" father: getElementsBytagName("his name") -> it will return a Node List get the first element casting as Element if there's only one, or elese if not case
    3)the same method in 2 get the "Grade" father
    4)getElementByTagName("Grade") over the "Grade" father -> for each "grade" element on nodelist do whatever you need
    i hope u understood...

  • PSE 9 Organizer error codec trying to add an Elements audio file to slide show

    I am using PSE 9 to build a slide show. When I add audio, I can use mp3's  from my music library in the slide show without any issues ...
    but I am getting the following error when I try to add an Elements audio file (example " A _Taste_Of_Sicily.mp3)
    This is the Organizer error message:
    "Unable to add the audio file (C:\ProgramData\Adobe\ElementsOrganizer\8.0\Music\A_Taste_Of_Sicily.mp3).
    The selected file cannot be played because your system does not have the required compresser/decompresser(codec) installed."
    I had PSE 8 and upgraded to PSE 9 - I noticed the error file detail shows 8.0 - Is this my problem - maybe an incomplete upgrade ?  (I've made several slideshows mixing photos and music, on an older computer using PSE 8 and never ran into this issue.)
    Below is my system info in case that helps:
    OS=Windows 7 Home Premium 64-bit on an HP Pavillion dv7
    Intel(R) Core(TM) i5-430M Dual Core processor (2.26GHz, 3MB L2 Cache) with Turbo Boost up to 2.53GHz
    8GB DDR3 System Memory (2 Dimm)
    500GB 7200RPM SATA Hard Drive with HP ProtectSmart Hard Drive Protection
    512MB ATI Mobility Radeon(TM) HD 5470 switchable graphics
    IDT High Definition Audio CODEC
    Thanks for any help !

    beccarie1 wrote:
    This is the Organizer error message:
    "Unable to add the audio file (C:\ProgramData\Adobe\ElementsOrganizer\8.0\Music\A_Taste_Of_Sicily.m p3).
    The selected file cannot be played because your system does not have the required compresser/decompresser(codec) installed."
    Does that file extension really have a space in it?  If so, remove the space.
    Ken

  • Add additional elements to a Custom BO

    Hey,
    I´m facing the following problem in my Custom BO. I want to add other elements to my existing Custom BO.
    In order to achieve this, I defined two elements in the Custom BO and activated the Custom BO.
    Then I add the two elements to my existing Webservice and activated it too
    Now when I execute my webservice, I get the following error message:
    Can anybody help me to solve my problem?
    Best regards
    Sebastian

    In order to check my webservice, I created an SOAP Project.
    When I execute my SOAP Project the following error occur:
    <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
       <soap:Body>
          <soap:Fault>
             <faultcode>soap:Server</faultcode>
             <faultstring xml:lang="en">RABAX occurred on server side</faultstring>
             <detail>
                <sap:Rabax xmlns:sap="http://www.sap.com/webas/710/soap/runtime/abap/fault/generic">
                   <SYDATUM>20140904</SYDATUM>
                   <SYUZEIT>140723</SYUZEIT>
                   <ERRORCODE>MESSAGE_TYPE_X_TEXT</ERRORCODE>
                </sap:Rabax>
             </detail>
          </soap:Fault>
       </soap:Body>
    </soap:Envelope>
    Then when I look in the Business Communication Monitoring the above mentioned error will be displayed. I dont know how to get more information about the error message and I dont know anything about this node  $t.L2S_CREZONE4E21178EA5ED4EBC .
    I just add two additional elements in my Custom BO. Before my changes the webservice works fine.

  • Create a text file in KM and add the structure of a node

    Hello Everybody,
    could some one please advise on how do I write the data stored in my node (elements) as string into a text file? How can i create a text file and add the structure of my node to it? I can just walk through my node recursively.
    Any help would be highly appreciated.
    Thanks in advance.
    Regards,
    Seed

    Are you referring to a org.w3c.dom.Node?
    In that case, the simplest approach would be to use KM's XML serializer (http://help.sap.com/javadocs/NW04s/current/km/com/sapportals/wcm/util/xml/SimpleSerializer.html)
    BR, Julian

  • Addding Doctype element

    Hai
    I need to add Doctype element dynamically for a DOM Tree. Later i am converting this DOM tree to xml file using transormfactory. I am unable to do this.
    xml file i need
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE map [ <!ELEMENT map (News_EventsRec*) >
    <!ELEMENT News_EventsRec EMPTY >
    <!ATTLIST News_EventsRec recID ID #REQUIRED > ]>
    <News_Events>
    <News_EventsRec recID="3">
    <Nev_Head>Head1</Nev_Head>
    <Nev_Desc>Desc1</Nev_Desc>
    </News_EventsRec>
    <News_EventsRec recID="3">
    <Nev_Head>Head2</Nev_Head>
    <Nev_Desc>Desc2</Nev_Desc>
    </News_EventsRec>
    </News_Events>

    sure:
    - adding DTD when outputting:
    Transformer transformer = TransformerFactory.newInstance().newTransformer();
    transformer.setOutputProperty(OutputKeys.DOCTYPE_SYSTEM, "test.dtd");- XSL for adding the DOCTYPE when outputting:
    <?xml version="1.0"?>
    <xsl:transform xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
    <xsl:output method="xml" indent="yes" />
    <xsl:template match="@*|node()">
      <xsl:copy>
        <xsl:apply-templates select="@*|node()"/>
      </xsl:copy>
    </xsl:template>
    <xsl:template match="/">
         <xsl:text disable-output-escaping="yes">
         <!DOCTYPE map [ <!ELEMENT map (News_EventsRec*) >
         <!ELEMENT News_EventsRec EMPTY >
         <!ATTLIST News_EventsRec recID ID #REQUIRED > ]>
         </xsl:text>
         <xsl:apply-templates />
    </xsl:template>
    </xsl:transform>

  • Creation of new element in Model Node

    Dear All,
    I am facing one problem, I have two  model node. I want to copy one model node to other model node.while copying its giving error saying the you can bind the element, coz target node doesn't have valid parent.
    Pl don't suggest me work on Value node.
    Can i create a element in model node at run time.
    Thanks & Regards
    Manoj Sahoo

    Hi Manoj,
                   Model node properties :
    1.A context model node makes a model object look like any other context node.  I.E. it gives the model object an API that is very similar to a value node.
    2.  A model node is not considered valid until it is bound to a corresponding model object.  Therefore, a model node always inherits its metadata from the model object to which it is bound.
    3. The element collection in a model node does not hold the actual runtime data!   Instead, it holds a list of references to the relevant model object instances.
    If u check the 2nd property, u will find the cause of ur exception. As u have already told, don't suggest to use value nodes, i don't have any other comment.
    regards
    Sumit

  • Can I add multiple elements on a single line?

    Can I add multiple elements on a single line?

    Not yet. But this is something we plan to support. You can vote on this idea here: http://forums.adobe.com/ideas/1046
    We use this to help prioritize our work.
    Randy

  • How to bind UI Element with Context Node Attribute Element

    Hi,
    I'm building my view dynamically in the wdDoModifyView method.
    Is it possible to bind a "TextView" element to a specific element of an attribute node?
    Scenario:
    Node_Employees
    |
    +- Attribute_Code
    |
    +- Attribute_Name
    Node Contents:
    Employees
    |
    +- Code: 1, Name: Employee 1
    |
    +- Code: 2, Name: Employee 2
    |
    +- Code: 3, Name: Employee 3
    I need to do something like binding a TextView UI element to the "Name" attribute of the element #2, what would result to show "Employee 2" on my view.
    How can I do this?
    Thanks in advance,
    Geraldo.

    Hi Saravanan,
    First I populate the context node and it won't change during view's lifecycle.  After that, I build my view and bind the TextView UI elements to the node context attributes elements.
    If the node has 10 elements, I will build 10 TextView UI elements and bind them to each attribute element.
    Regards,
    Geraldo Brígido.

  • Can't add list element when calling a method from another class

    I am trying to call a method in another class, which contains code listmodel.addElement("text"); to add an element into a list component made in that class.
    I've put in System.out.println("passed"); in the method just to make sure if the method was being called properly and it displays normally.
    I can change variables in the other class by calling the method with no problem. The only thing I can't do is get listmodel.addElement("text"); to add a new element in the list component by doing it this way.
    I've called that method within it's class and it added the element with no problem. Does Java have limitations about what kind of code it can run from other classes? And if that's the case I'd really like to know just why.

    There were no errors, just the element doesnt get added to the list by doing it this way
    class showpanel extends JPanel implements ActionListener, MouseMotionListener {
           framepanel fp = new framepanel();
           --omitted--
         public void actionPerformed(ActionEvent e){
                  if(e.getSource() == button1){
                       fp.addLayer();
    /*is in a different class file*/
    class framepanel extends JPanel implements ActionListener{
            --omitted--
         public void addLayer(){
              listmodel.addElement("Layer"+numLayer);
              numLayer++;
    }

  • Add web element in Crystal report for SAP system

    Hi all,
    I have added web element in Crystal report for SAP system (BI or R/3) . But it does not show the control. It shows only scipt.It does not render the HTML.
    But if I add the webelement for Excel sheet ,It shows the control.
    How can I add web element for SAP System? Can't we use web controls in SAP system ?
    Help me in this regard.

    Hi All,
    i have the same issue on crystal report add-ins. Have you able to solve this without upgrading our sap business one to the latest version or patch level? Please see details below.
    OS: MS Windows 7 SP1
    SAP Business One 8.82 pl7
    Crystal report 2011
    Crystal report integration package installed under B1_SHare/Client
    But still the problem persist on the workstation.
    Please help me solve this problem.
    Thank you,
    ana

  • Add multiple elements to a tree control at once

    I am using a Tree Control to display customer and certificate information. However, adding 500 customer names or certificate numbers to the tree control one at a time takes for ever (well, 30000 ms). Is there any way to add multiple elements to a tree all at once, or is the only solution to use a listbox with 'forward' and 'back' buttons ?
    thanks,
    michael

    Hi Michael
    I don’t believe there is a way to supply a list of child items to a parent item, they have to be added incrementally. One way that you could speed this process up is to design your code such that only when you expand an item does it add the child items.
    If you want an even higher update rate have a look at using the ActiveX TreeView control, you will find an example called Family Tree.vi in the LV examples.
    I'll do up some code that makes using both of the controls more efficient if enough people want it.
    Kurt Friday
    www.sciware.com.au

Maybe you are looking for

  • Is it possible to upgrade from Lion 10.7.5 straight to the latest Yosemite in one go?

    My daughter has a MacBook Pro early 2011 13 inch model. Can an she upgrade straight from Lion to Yosemite? TThanks sSteve

  • Is it possible to create invoice for Free of Charge order

    Dear All, Is it required to create a Billing document for an Free of charge order as far as Indian scenario is concerned. We are not charging any value to the customer for Free of Charge. Free of Charge order value will be Zero only. In this case, is

  • For the benefits of those who want to upgrade to Tiger 10.4.4

    My upgrade finally let me enjoy Logic. I was always stuck to 3 or 4 tracks, over this I was getting the famous CoreAudio overload, Disk too slow blablabla. Now I'm at 9 tracks with the same song that I was stuck to 4 tracks 2 days ago. I can't tell y

  • Em/dcmctl too slow

    Hi, all: Is there a way to speed up the response time of em/dcmctl tools? It takes quite a while to come back every time. Sometimes with an error then have to start over again. Or any document about manually config the oc4j property files (other than

  • ACPI Table not in Reclaim memory error, HELP!!!! please

    Totally new to this, only used Solaris on a Sparc. The CDROM is in the drive, it boots up at startup and says "SunOS Secondary Boot Version 3.00 Warning: ACPI Tables not in Reclaim memory prom_panic: kmem_free block already free entering boot debugge