How to populate a Value Attribute of a Value Node inside Model Node

Hello
I have my context like this.
  Context
..          - ModelNode
....                      - Model Attr1
....                      - Model Attr2
....                      - Model Attr3
....                      - Model Attr4
....                      - Value Node
......                                  |
......                                   - Value Attr1
Model Node is of Cardinality 0..N
Value Node is of Cardinality 1..1
I want to create multiple records in my Model Node and one record for every Model Node in Value Node.
How to do this?
All good suggestions are welcome.
Regards,
Shubham

Hi Shubham,
With your context structure the code will be
for(int i = wdContext.nodeModelNode().size()-1 ; i>=0 ; i--)
    IPublic<comp name>.IModelNodeElement ele =   wdContext.nodeModelNode().getModelNodeElementAt(i);
    IPublic<comp name>.IValNodeElement valEle = wdContext.nodeModelNode().nodeValNode().createValNodeElement();
    valele.setValAttr("");
    ele.nodeValNode().addElement( valEle);
Your val node should be non singleton (singleton property = false)
Regards,
Jaydeep

Similar Messages

  • Invalidate concept for value node and model node

    Hello everybody,
    We have invalidate method for value node and model node.
    I want to know basic concept behind this method.
    What this method acually does?
    Regards,
    Bhavik

    Hi Pran and all,
    I figured out the problem. Input parameters are going multple times. So, depending upon that it gives multiple values.
    My scenario is:
    Root Node
    |_ Input_node1
         |_Attr1
    |_ Input_Node2
         |_Attr2
    |_Output_node
         |_Result
    I am passing values in Attr1 and Attr2 attributes.
    For this, first of all, i wrote following code.
    In controller, i have initialized Root node:
    Root_Node model = new Root_Node();
    wdcontext.nodeRoot_Node().bind(model);
    In view, I set values for attr1 and attr2 using following code:
    Ipublic<View>.IInput_node1Element ele = wdcontext.createInput_node1Element();
    ele.setAttr1("<value>");
    wdcontext.nodeInput_node1().addElement(ele);
    Ipublic<View>.IInput_node2Element ele1 = wdcontext.createInput_node2Element();
    ele1.setAttr2("<value>");
    wdcontext.nodeInput_node2().addElement(ele);
    But this code didnt work. Model was executed without data in this case.
    So, i thought that these elements were created at view level only. And corresponding model objects were not created.
    So, I have changed code like following way:
    I have removed initialization code for Input_Node1 and Input_Node2 from view. Now, I am getting input values in two different value nodes. And before calling custom controller's method to execute model, I am making two ArrayLists and filling data in it. Now, i am passing these ArrayList objects as parameters to controller's method.
    In this method, i am setting both values as follows:
    wdcontext.currentRoot_NodeElement().modelObject().setInput_Node1(List1); 
    wdcontext.currentRoot_NodeElement().modelObject().setInput_Node2(List2); 
    Then i am executing my model.
    But, When i am setting values for Input_Node1 and Input_Node2 as shown above, values are appended instead of overwritting the value. Because of this appended values, it gives mupltiple results.
    Means, Both ways are not proper. What should be the proper and best way to pass values in this case?
    Thanks,
    Bhavik

  • How to map single context value attribute to multiple value attributes?

    Hello,
    is there any way to map a single value attribute
    from view's context into several value attributes
    in controller's context?
    The business context of what I want to achieve
    is the following: I have a view which can be called
    in two modes: read only (RO) and read-write (RW).
    The input parameters to the view are the same for
    both modes, however when in RO mode, the view calls
    a different set of web services than when called
    in RW mode. Before calling each of the web services
    I need to populate their context value attributes
    with appropriate input values.
    I know I can do it in Java code, but is it possible
    to do it without any programming (doing it in the
    source code is prone to errors)?
    Any help highly appreciated.
    Greetings,
    Tomek.

    Hi Kishore,
    than you very much for your kind help.
    I have already created a value attribute of type
    boolean and mapped it into the read-only property
    of the UI elements. This however does not solve all
    of the problems... I will describe it with an
    example:
    Let's say the form I want to implement will be
    used to: create (read-write mode), update (read-
    write mode) or show (read-only mode) customer's
    data. The customer's data is complex (lots of
    data, including tree structures).
    The problem is that:
    - when the form is called in read-only mode,
      it should populate its fields with values
      provided by the getCustomerData web service,
    - when the form is called to create a new
      customer (in read-write) mode, it should
      not use the getCustomerData web service.
      Instead it should map the input values
      entered by the user into input parameters
      of the createNewCustomer web service,
    - when the form is called to update customer's
      data, it should first display values returned
      by the getCustomerData web service, and then
      it should map the modified values entered by
      the user into input parameters of the
      updateCustomer web service,
    In all the above cases I must map my view's
    context data to different controller's context
    elements. Doing it directly in the source code
    is not a nice solution. Is there any other
    way to achieve this? 
    Calling a form in different modes in not an
    unusual thing, so I was hoping that maybe
    there are any built-in mechanisms that would
    solve the obove problem...
    Greetings,
    Tomek.

  • Access a value attribute under a value node

    Hi guys,
    Could you please help me on this one. I need to access value attributes that are under a value node?. I use the following codes and I always have the error "java.lang.NullPointerException ".
    1) wdThis.wdGetContext().currentMyValueNodeElement().getMyAttribute();
    2) wdContext.currentMyValueNodeElement().getMyAttribute();
    Thanks in advance
    Franck

    HEre is an example where I'm pulling a value from a value attribute where the Node is a table.  "Ytdsl" is the actual value attribute name.
              //      Get the total  from the last line of the table
              String sx =
                   wdContext
                        .nodeChannelList()
                        .getElementAt((wdContext.nodeChannelList().size() - 1))
                        .getAttributeValue("Ytdsl")
                        .toString();
    Regards,
    Rich Heilman

  • How to populate a text field by some value from table in Oracle seeded page through Personalization?

    I have to populate Description field by default in AGIS page (Advanced Global Intercompany System).
    Field Description:
    messageTextInput: Description
    VO: FunTrxHeaderVO
    VO Attribute: Description
    VO is entity based.
    Now if the field is null then I have to populate this value by some value from table for selected batch_id.
    Example:
    (SELECT DESCRIPTION FROM fun_trx_batches WHERE batch_id =
    211061)
    Also, this value is being populated in the Batch Information region in the same page. So the problem is also be treated as to copy a value from one messageStyledText to messageTextInput in a same page.
    Can this be done through personalization, w/o coding?
    Please suggest if you any idea how to resolve..
    Regards,
    Pahari

    Not sure why it is not displying in the front page list??
    I have to search it.
    Admin team, please help.
    Regards,
    Pahari

  • How to populate a Dropdown List from a Value Node

    Hi
    I have a WD application Java with an Interactive Form. In the WD context I have a value node of cardinality 0..n. In the Interactive Form I need to have the values of this node within a dropdown list. Which type of DDL is best choice and how do I manage to get the node values into the list.
    We are working on NW2004 with Designer 7.08.
    Thank you for any suggestions.
    René Morel

    hi,
    With respect to your problem please refer to this guide/tutorial.
    https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/98af7acd-0401-0010-f697-bfa06971b65e
    Hope this helps you.
    Thanks,
    kris

  • Attribute of the BO is BO themself - how to populate its own attributes?

    Hi Gurus,
    In my BO (say ZBO) there is a virtual attribute defined as type of standard BO USR01. The problem is that in workflow log this attribute is filled but not completely. I mean that its name in Workflow Log is 'USR01:user_name' (not <No instance>) but when I click expand on this object attribute to see its own attributes, they are not filled with values. Why are these attributes for my object attribute are empty?
    Here is the implementation for this attribute in ZBO:
    GET_PROPERTY CREATOR_VIRT_OBJ CHANGING CONTAINER.
    SWC_CREATE_OBJECT OBJECT-CREATOR_VIRT_OBJ 'USR01' sy-uname.
    SWC_SET_ELEMENT CONTAINER 'CREATOR_VIRT_OBJ' OBJECT-CREATOR_VIRT_OBJ.
    END_PROPERTY.
    Thanks and best regards
    Pavel

    Hello Rick,
    Thank you again! Maybe with your valuable help the problem could be solved.
    I assume you mean attribute Creator of BO FORMABSENC?
    Yes, that is correct.
    It worked for me, if I click on the Task container for the first step then I see:
    Notif. of absence TEFCLNT120FORMABSENC000000012
    But for me it doesn't work. I will try to give detailed steps I made:
    1) I load WS70000704 workflow in tx. SWDD;
    2) I push F8-button to test it;
    3) I push F8-button again to execute the workflow;
    4) "Create notification of absence" screen appears;
    5) Then I push save button;
    6) Now I'm on the initial screen for testing workflow;
    7) I press Workflow log button;
    8) Then I click on the "Create notification of absence" step and choose "Container" tab;
    9) There I see WIOBJECT_ID = FORMABSENC:0000000061 and click expand;
    10) I see all the attributes related to FORMABSENC (Number, Creator, Approver, ApprovDate, ...);
    11) Creator is USR01:MY_UNAME - so it seems like all is correct, but if I click expand button for Creator then all its attributes (ID, Calendar, OutputDevice, ...) are not filled, they are marked as <Not Set>.
    That's my problem and I wonder that you have all theese attributes filled... That is really strange, maybe the case is some bug or some customizing is necessary...
    When you execute the workflow, does it take you to the "Create Notification of Absence"
    screen? If so, what's filled in for "Issuer" field at the bottom of the screen?
    Yes, it does. It is my username as Issuer (MY_UNAME).
    Do other attributes get saved?
    Yes, they do (except of Approver, ApprovDate but it is correct until approver approves the absence request).
    Are there any errors or warnings in the workflow log?
    No.
    The numbers at the end of the value (above; eg 000000012) is the key of
    an instance of FORMABSENC. If you go to SWO1, test FORMABSENC and fill in
    that key, is the creator shown then?
    I go to tx.SWO1 and push "Test"-button, then I click "Instance"-button and enter my key number for the created notification '0000000061'. It shows me my FORMABSENC-object, then I click button "Edit object reference" opposite the CREATOR attribute and it is correctly filled! Then I just press "BACK"-button and the system shows me short dump OBJECTS_MOVE_NOT_SUPPORTED with short text "Conversion of type "SWC_OBJECT" to type "r" not supported" Have you faced with the same error? Maybe I need to search for a SAP note.
    Thank you and best regards
    Pavel

  • Value attribute not visible in runtime collection

    Hi,
    I have created some 2-3 value attributes (display only) in a standard model node for BTDOCFLOW (which also contains some display only fields). Put in the logic in their Getter methods and fields are getting displayed in UI with the values.
    Now, my requirement is to display this table view (Assignment block) in default sorting based upon one value attribute and one model node attribute. But the problem here is, I am unable to find value node attribute at runtime in BTDOCFLOW collection at DO_PREPARE_OUTPUT. (Even display only standard context node attributes, which are not part of model node structure are not visible)
    I have re-defined method GET_TABLE_LINE_SAMPLE with the value attributes, resulting in enhanced rv_sample line, but still the value attribute is not visible at runtime in the collection.
    Can someone pl. tell me, how can I display my value attributes in collection along with model node attributes, so that I can do default sorting based upon one custom and one model node attribute.
    Thanks,

    Hi,
    Whne you define value attributes within the model attribute then the node becomes mixed instead of either value node or model node.
    So you need to access the mixed node and then should access model attributes and value attributes separately.
    Get your collection into a normal entity then assign the entity to mixed node
    DATA: lr_mixed TYPE REF TO cl_bsp_wd_mixed_node ,
                current TYPE REF TO if_bol_bo_property_access,
                 lr_current TYPE REF TO cl_crm_bol_entity.
         current ?= me->typed_context->entity name->collection_wrapper->get_current( ).
          lr_mixed ?= current..
          lr_current ?= lr_mixed->if_bsp_wd_ext_property_access~get_model_node( ).
    Best Regards,
    Dharmakasi.

  • How to populate values dynamically in dropdownbykey

    Hi All,
    My requirement is to populate the dropdown filled in with values( and key) which are coming from the ZBAPI call ie web service model.
    How do i achieve this ?
    Kindly provide me with some pseudo code.
    Reg/Venkat

    Hi Venkat,
              You can populate dropdown values from webservice using the following steps. I assume you gave idea about custom controller.
    step1:
          Create custom controller.Inside custom controller Bind input value then execute webservice.
    step2:
          Now you have value node which is returned from web service. find thr size of value node.  
    After execute web service you can find size using the following code. create value node and model node object using the code.
    Step3:
    <custom controller name>.IRole_ResultNode modelnode=wdContext.nodeRole_Result();
    <custom controller name>.IRole_OutputNode valuenode=wdContext.nodeRole_Output();
    valuenode.invalidate();
    int size=modelnode.size();
    Step4:
         After find size using loop fetch values from model node into value node.Asume in this value node contains key and value.
    for(int x=0;x<modelnode.size();x++){
    <custom controller name>.IRole_ResultElement  modelElement=modelnode.getRole_ResultElementAt(x);
    <custom controller name>.IRole_OutputElement valueElement=wdContext.createRole_OutputElement();
    valueElement.setId(modelElement.getKey());
    valueElement.setText(modelElement.getValue());
    valuenode.addElement(valueElement);
    step5:
    After that bind this value node(Role_Output) into Component controller. Then Bind value node(Role_Output) from component controller into view.
    Step6:
    Finally bind dropdown UI Element into Role_Output node's attribute(ID).
    Kind Regards,
    S.Saravanan

  • How to populate a context node on the basis of the values in another node?

    Hi,
    I have a Webdynpro application which has to run on Portal as well as BlackBerry.
    In this application I have a scenario where I need to have a sub node inside a node but as Blackberry doesn't support sub nodes with Singleton value false, I have to use another node for storing the values which earlier wre present in the sub node.
    The actual scenario here is that we have two tables A & B. For each row of table A we have a no of rows in table B. This can be easily accomplished for Web Browser but we need to do this for Blackberry.
    My question here is that how can i populate the data in table B at runtime using the concept of onLeadSelect. I am not able to fully undersans this concept.
    According to my approach I have two a while loop which generates data for  table A and inside this while loop I have another while which generates data for table B corresponding to each iteration of the outer while loop. I create the node elements for the rows of the table B and store them in a list and then store this list in a HashMap corresponding to a key formed by combining the values of all the elements of the row of table A.
    Now I am not able to understand how can I display this data into table on user slecting a particular row.
    Please guide ASAP.
    It wille quite useful if you can provide me with some code snippets for the same.
    Thanks in advance!
    Manish

    Hi Manish,
             In WebDynpro u can use the onLeadSelect event of table A and do all the processing in that method.Like u can use this method to fill ur context node,which will be the source node for table B. So this way u need not to use any hash map.Fill the source node of table B with data corresponding to ur selected data of table A.
      I hope this solution wud help u in solving ur problem.
    Reena

  • How to query involving Multi-Value Attributes objects

    Hello.
         I have one question regarding coherence. We are looking for best and the fastest way to query multi-value attribute of objects. In Coherence User guide there is example, that shows, how can this be made with java.lang.String object:
         Set searchTerms = new HashSet();
         searchTerms.add("java");
         searchTerms.add("clustering");
         searchTerms.add("books");
         // The cache contains instances of a class "Document" which has a method
         // "getWords" which returns a Collection<String> containing the set of
         // words that appear in the document.
         Filter filter = new ContainsAllFilter("getWords", searchTerms);
         Set entrySet = cache.entrySet(filter);
         // iterate through the search results
         But I would like to know, how can this be made with some other object type. For example I could have object MyCoherenceObject with attribute HashSet<Identifier> idHashSet that would represent Person object that has composite key comprised of name and lastname. Identifier object would contain two attributes of type String: name & value.
         So basically I could have two identifiers in list:
         public MyCoherenceObject {
         public HashSet idHashSet = new HashSet();
         public MyCoherenceObject() {
         Identifier id1 = new Identifier("name", "John");
         Identifier id2 = new Identifier("surname", Smith");
         idHashSet.add(id1);
         idHashSet.add(id2);
         public HashSet getIdentifiers() {
         return idHashSet;
         This object would later be inserted in coherence cache. When query over coherence cache would be performed I would like all objects where multi-value parameter with name="name" equal "John" and parameter with name="lastname" equal "Smith". My code would look something like this:
         Set searchTerms = new HashSet();
         searchTerms.add("John");
         searchTerms.add("Smith");
         // The cache contains instances of a class "Document" which has a method
         // "getWords" which returns a Collection<String> containing the set of
         // words that appear in the document.
         Filter filter = new ContainsAllFilter("getIdentifiers", searchTerms);
         Set entrySet = cache.entrySet(filter);
         // iterate through the search results
         How can this be done. Basically I don't know how to search in multi-value attribute if one value represents arbitrary object and how to tell coherence which getter fuction must be used for comparison. In my case getValue() must be used and not getName().
         Second problem:
         Coherence must not return Person object with name="Smith" and lastname="John". Here upper filter would be satisified, but problem is that I am looking for person with lastname "Smith" and name "John".
         Domain description:
         I will have different objects of same type in coherence cache with different multi-value attribute list length. For example some objects will have only one identifier object in list (e.g. Phone "phoneNumber") some two (e.g. Person "name", "lastname") and other objects will have maybe three identifier objects (e.g. City "country", "area", "state").
         If there is faster way to do this in Coherence (I saw examples with getters that contain attributes for example), please give me some directions.
         Thank you very much for your help.

    When filtering based on the getIdentifiers, you should add Identifier instances into the searchTerms collection, and it will satisfy all your expectations. If you add simple Strings into that searchTerms collection, then none of your queries will return anything, because the String will never equal() the Identifier instances.
         You can also add an index on the getIdentifiers() method. However, the Identifier class should properly implement the equals() and hashCode() methods, and in order to be able to use an ordered index (you don't need that for the current requirements you listed), it should also implement Comparable.
         BR,
         Robert

  • How to read  data from a value attribute

    I  have a context node which has some value attributes.the value to these attributes have been set in their setter/getter methods . How do i read data in the do_prepare_output ,because this attribute does not get recognised when i do get_property_as_string( iv_attr_name = 'XYZ' ). Please let me know how this can be done .

    Hi Shakuntala,
    Value attributes are only for display purpose.
    Check where is the value for the Value Attribute you are trying to read getting stored in SET method.
    For example, Employee Responsible has a value attribute RESPONSIBLE_NAME_UI on the screen
    but in turn the value gets stored in the 'RESPONSIBLE_NAME' and 'RESPONSIBLE_TEXT'.
    You can get these fields in SET method.
    Now when you want to read, use the logic available in GET method for the value attribute like this
      value = me->get_responsible_text( attribute_path = '//TRADE/RESPONSIBLE_TEXT' ).
      IF value IS INITIAL.
        value = me->get_responsible_name( attribute_path = '//TRADE/RESPONSIBLE_NAME' ).
      ENDIF.
    Regards,
    Masood Imrani S.

  • How to populate values in to drop down by index from modelnode

    Hi
    I have a dropdownby index and amodel node..model node contains text and value.which i need to be binded to dropdown text or value..and what is purpose of text and value..and is the code required to get texts populated into dropdown.
    Thanks
    Rahul

    Hi,
    The dropdown is usually part of a form, where the selected values are used as form input. For WD it is the input for the backend function. E.g. when the user selects 'Netherlands' from a dropdown list with countries, the backend function should in most cases be filled with the country key, which is often '31' or 'NL' but not 'Netherlands'.
    Now if you are using the dropdown for other purposes than as part of a form (e.g. when you want to change the data or view depending on the current dropdown value), the key is not used.
    Hope this clarifies.
    Good luck,
    Roelof

  • Reg Value Attributes

    Hi
    I want to know how to delete the value attribute.

    If the value attribute has been created by right clicking the enhanced context node, (whether its a table view or normal view)
    we can right click the attribute and delete it. This  will delete all methods associated with it too.
    Also for cross verifying, better go to the context class and check the methods still remain or not, if yes, delete from the method list also.
    Regards,
    Lakshmi

  • Automaticly create value attributes

    Hi,
    Is there a way to create automaticly value nodes and attributes in NWDS. The bapi only provides me the fieldname, -index en value. so it is only a table dumb of the r3 back-end.
    So I want the field values automaticly be created as an value attribute in a value node. So one way or an other I have to extract the data from the table into NWDS

    S.,
    Yes, this is possible.
    First, create empty value node in context, name it for example DynamicNode. Next, iterate over rows in table and dynamically add attributes:
    wdContext.getContext().reset(false);
    final IWDNodeInfo niDynamic = wdContext.nodeDynamicNode().getNodeInfo();
    for (int i = 0; i < rfcTable.size(); i++) {
      final <RfcStructureName> row = (<RfcStructureName>)rfcTable.get(i);
      niDynamic.addAttribute(row.getFieldname(), "ddic:com.sap.dictionary.string");
      /* above is string type used, other possible as well:
         integer, double, date, time, boolean etc
    Finally, iterate RFC table once again and create element:
    final IWDNodeElement entry = wdContext.nodeDynamicNode().createElement();
    for (int i = 0; i < rfcTable.size(); i++) {
      final <RfcStructureName> row = (<RfcStructureName>)rfcTable.get(i);
      entry.setAttributeValue(row.getFieldname, row.getValue());
    wdContext.nodeDynamicNode().addElement(entry);
    Valery Silaev
    SaM Solutions
    http://www.sam-solutions.net

Maybe you are looking for

  • PDF problem with Adobe Reader X1 ~ 11.0.09

    I have Adobe Reader X1 ~ 11.0.09 I am working on a MacBook Pro 10.7.5 and still running Lion A problem that has occurred only lately is, when I've wanted to look at a pdf on line the entire page is black.  Please tell what I can do ?  This never happ

  • After deleting "Envelope Index" files Mail cannot re-index

    I followed the common suggestion of deleting "Envelope Index" files to speed up mail, but after restarting Mail, it freezes when re-indexing my archive: it blocks after indexing just 6,000 messages out of my 600,000 messages (I have a pretty big emai

  • Cannot roll back to Firefox 4 after installing Firefox 12

    I'd upgraded to Firefox 12 from Firefox 4 on my Windows XP system, and it consistently closes instantly when starting, no crash dialog, no errors, nothing. Just instant close. I've tried opening it in safe mode, disabling all add-ons, and restarting

  • Nokia 7373 Help

    I have just brought a 7373 and I am really struggling to use it in terms of an MP3 player. How are you to get the data onto your phone? My previous phone connected with a USB cable however I am finding that with the 7373 there is very little on the n

  • Duplicate photos on iPad

    Hi I've just upgraded to iOS 7.0.6. When viewing photos using the album tab everything appears fine, if I look at my photos via the photo tab I appear to have duplicates of every photo. Is this something to do with photo stream? If viewing an individ