How to access a dynamic created attribute in a context node?

<i>Hello,</i>
<i>who could help? I can't set a value for a dynamically created attribute which is bind to a table.</i>
<i>My context of the view looks as follow (is defined in NetWeaver):</i>
  - Context
     - Availability (Node)
         - vctxService (Attribute)
         - vctxServiceDesc (Attribute)
         - ... (further predefined attributes)
         - ... (some have to be set dynamically as follows)
<i>Then I have added attributes dynamically in the wdDoModifyView(...) - method, as follows:</i>
for (int i = 0; i < max; i++) {
   // some code to dynamically create table columns
   // adding attributes dynamically
   IWDAttributeInfo attrInfo =       wdContext.nodeAvailability().getNodeInfo().      addAttribute("vctxAvailability_" + i, "ddic:com.sap.dictionary.string");
   tv.bindText(attrInfo); // bind to TextView in table
<i>In the method onPlugFrom... I tried to set the values for the attributes "vctxAvailability_ + i" as follows:</i>
for (int i = 0; i < max; i++) {
   IAvailabilityElement newAvailNodeElement =     wdContext.createAvailabilityElement();
   // some values will be set for the
   // predefined attributes of AvailabilityNode
   // newAvailNodeElement.set...( value );
   // newAvailNodeElement.setVctxService( xy.getServ() );
   // now the values of dynamically created and added
   // attributes in AvailabilityNode will be added
   // THIS DOESN'T WORK
   newAvailNodeElement.setAttributeValue    ("vctxAvailability_" + i, "value" + i);
<i>It would be great if someone could help me.
Thanks in advance.
Kind regards,
Carsten</i>

Carsten,
Here is a sample code that creates context attributes dynamically and also sets values:
//Creates a node
IWDNodeInfo nodeInfo = wdContext.wdGetAPI().getRootNodeInfo().addChild("TestNode", null, true, true, false, true, false, true, null, null, null);
//If you want to bind the node to a model node then the
//second argument to the above method should be the
//model class.
//Creates an attribute under the node just created.
IWDAttributeInfo testAttrib = wdContext.wdGetAPI().getRootNodeInfo().getChild("TestNode").addAttribute("testAttrib", "ddic:com.sap.dictionary.string");
IWDNodeElement testNode = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION).getCurrentElement();
IWDNode testNode2 = wdContext.getChildNode("TestNode", IWDNode.LEAD_SELECTION);
//Now you can bind testNode with the Model Node
//You can also set a value to the newly created attribute
testNode.setAttributeValue("testAttrib", new String("Value"));
Hope this helps.
Shakeel

Similar Messages

  • How to Access the Dynamically created form element

    Hi friends,
    I have generated a dynamic form in flex using xml and i want to save the all the elements of the form with there label and entered data in the formItem.
    so i m getting how to save the data.
    anybody have idea about this?????
    Thanking you
    Gajanan

    Thanks for your reply.
    as u said i have done this
    for each(var formItem:FormItem in form.getChildren()){
                            formItem.label //The FormItem's label's text
                            formItem.getChildAt(0) //The first child - TextInput, ComboBox or whatever you got
                            Alert.show(formItem.getChildAt(0).toString());
                            return;
    my first child formitem is TextInput and i entered some value in tat textInput but i m printing this i m getting the "dynamicform.ApplicationSkin3._ApplicationSkin_Group1.contentGroup.grp.Form0.FormItem15.txt studentfname"  i m getting this output
    i want to access the entered value of in the textInput.
    Thanks,
    gajanan

  • How can I bind a dynamic attribute of a context node to ALV?

    Hi all,
    I'm trying to show data with Webdynpor ALV, but i met a question which blocked me. The situation is that there is a static context node and it's mapped to WD ALV, while programming I create a dynamic attribute to the context node. The dynamic column can be shown on the UI, but there is no any data in it. How can i deal with it?
    Thanks a lot!
    Edited by: Julia Zhu on Dec 3, 2009 7:48 AM

    Hi Julia,
    Welcome to SDN.
    Post it in the ABAP webdynpro forum to get quick replies. Web Dynpro ABAP
    Also search in sdn as there are chances that somebody has already posted the queries related to same issue.
    Regards,
    Swarna Munukoti.

  • How to access the activities created by an enduser especially when the enduser has left the organization?Please help me out with the possible solution

    How to access the activities created by an end user especially when the end user has left the organization?Please help me out with the possible solution

    Hi Ramesh,
    In the web UI we have business role IC_manger where you can search the activities based on employee responsible and you can use business transaction assignment functionality to assign those activities to any  other end user or team.
    Else you can also use Agent inbox functionality if you have configure the agent inbox for those activity.
    Hope this helps solving your query

  • How to read the attribute in another context node from setter method

    Hi,
    As part of the  requirement
    i need to read the STRUCT.E_MAIL ( attribute ) present  in  INDEPENDANTEMAIL context node  from  the SET_S_SRUCT method of the context node  HEADER.
    I tried th following but it didnt work out....
    Get the Custom Controller Path
    *lr_cuco ?= controller->get_custom_controller( controller_id = 'BP_HEAD/IndComm').
    *IF lr_cuco IS BOUND.
    Get the Entity
    *lr_entity ?= lr_cuco->typed_context->independantemail->collection_wrapper->get_current( ).
    *ENDIF.
    *CHECK lr_entity IS BOUND.
    Get the Trade Event Type.
    *lv_email  = lr_entity->get_property_as_string( 'E_MAIL' ).
    also i tried ...
    data:
    *lv_value type string,
    *lr_property type ref to if_bol_bo_property_access.
    *lr_property = collection_wrapper->get_current( ).
    *lv_value = lr_property->GET_PROPERTY_AS_STRING( importing iv_attr_name = 'E_MAIL'
                                                returining  ev_result    = lv_email ).
    but it didnt workout ......
    Any suggestions   ...................
    Regards,
    Sijo...

    Hi,
    Both Context node are available in view then refer this link.
    Reading Attributes from different context nodes in the same view
    Relationship name for context node INDEPENDENTMAIL is 'BuilIndependantEmailRel'
    Regards
    Gaurav

  • Access attribute of a context node in another context node of the same view

    Hi all,
    I want to acess value of an attribute PERNR of context node CUSTOMERS in another context node AUTHENTICATION of the same view. A sample syntax would be helpful .
    Thanks,

    You didn't specify your version of Oracle so here are two options. If 10.2 or greater, use XMLTable, else use the ExtractValue option.
    -- The WITH simply simulates your existing table that I do not have.
    WITH fake_tab AS
    (SELECT XMLTYPE('<?xml version="1.0" encoding="ISO-8859-1"?>
    <Settings>
      <Setting Name="A1" Value="N"/>
      <Setting Name="A2" Value="N"/>
      <Setting Name="A3" Value="SOMEVALUE"/>
      <Setting Name="A4" Value="N"/>
      <Setting Name="A5" Value="Y"/>
      <Setting Name="A6" Value="N"/>
    </Settings>
    ') tab_col
      FROM dual)
    -- For 10.2 and higher use this SELECT
    SELECT a5
      FROM fake_tab,
           XMLTABLE('/Settings'
                    PASSING fake_tab.tab_col
                    COLUMNS
                    a5   VARCHAR2(10)  PATH 'Setting[@Name="A5"]/@Value');
    -- For 10.1 and before
    SELECT ExtractValue(tab_col, '/Settings/Setting[@Name="A5"]/@Value')
      FROM fake_tab;

  • Reading Attributes from different context nodes in the same view

    Hi,
    I have added a new field as part of an enhancement for Trade Promotions. This field is a checkbox and part of the context node TRADE in the view TPMOE/HeaderEOF. This field will be checked or unchecked using a logic in the background.
    The logic will be based on an attribute (Fund Plan ID) which is part of another context node FUNDPLAN in the same view.
    How can I read the attribute of FUNDPLAN context node in TRADE context node?
    A sample code will be quite helpful as I am new to CRM 2007.
    Thanks,
    Abhishek
    Edited by: Abhishek  Periwal on Oct 16, 2008 2:35 PM

    Hi Abhishek,
    If I understand your question correctly, you would like to access the Fund plan ID (in a different context node) in the getter setter methods of the check box attribute which you have added.
    The code snippet mentioend by sudeep works perfectly fine when you are making any checks in the view implementation class. But since you are in the getter setter methods of the context class, this doesnot work as "me" always refers to the class instance in which you are present.
    Now in this case what you need to do is :
    1)  create an attribute <view_controller> in your context class. Here the context is TRADE. The type of this attribute wud be same as the view controller class CL_TPMOE_HEADEREOF0_IMPL
    2) Go to the view controller class and redefine the method
    DO_VIEW_INIT_ON_ACTIVATION. This method is called only once when the view is loaded for the first time.
    3) In this method, put the following code
    me->typed_context->(Trade)->[view_controller] = me.
    by the above code, you are setting the newly created attribute to the view controller instance.
    4) The next step would be, go back to your getter setter methods or what ever it may be, try referring to the Fund plan ID by the code snippet mentioned below
    data: lr_entity type ref to cl_crm_bol_entity.
    lr_entity ?= me->[view_controller]->typed_context->[the context node in which the fund plan id is present]->get_current().
    lv_field_value = lr_entity->get_property_as_String( **pass the field name here ).
    This should definitely resolve the problem.
    Thanks,
    Vinay

  • Reading Attributes from same context node of different attributes

    Hi,
    I  want read Attributes from same context nodes of diifrent attributes.
    I have attribute A and B of same node, want to get read value from  atrribute A into B.
    Regards,
    Brahmaji

    solved
    DATA: lv_current TYPE REF TO if_bol_bo_property_access.
       DATA: lv_value type String.
       IF iterator IS BOUND.
        lv_current = iterator->get_current( ).
      ELSE.
        lv_current = collection_wrapper->get_current( ).
      ENDIF.
      CALL METHOD current->get_property_as_string
            EXPORTING
              iv_attr_name = 'ZZAFLD00004Y'
            RECEIVING
              rv_result    = lv_value .

  • Reg  : Accessing dynamically created attribute

    Hi All,
             I had created a dynamic node ("demo") and added two attributes ("appid" & "apptext") to it. And also i created three elements for that node and binded the values. Now my dynamic node is having 3 records. I am creating link to action dynamically and binded a action called "onClick". Now in the output i am getting
    linktoaction1
    linktoaction2
    linktoaction3
    Now i am stuck with, when i am clicking either of these 3 linktoactions in runtime, i am able to get only the first record. May i know how to traverse through the node. i.e on clicking of linktoaction2 i want to fetch second records of the node and simillarly and linktoaction1 and linktoaction2. I used the following code in "onClick"
    IWDNode dynnode = wdContext.currentContextElement().node().getChildNode      ("demo",IWDNode.LEAD_SELECTION);
    IWDNodeElement ele = dynnode.getCurrentElement();
    String text = (String)ele.getAttributeValue("Apptext");
    wdComponentAPI.getMessageManager().reportSuccess(text);
    Thanks,
    Mugundhan.

    Hi Nikil,
    Ya i had assigned only one action for the three linktoactions. I am filling my dynamic node according to the number of records coming from the RFC. How can i pass the index value (i.e) how to identify that which action is being clicked. I am little confused. Thia is what i wrote in my coding,
    In Init method,
    IWDNodeInfo nodeInfo=wdContext.getNodeInfo().addChild("demo", null,true,true,
    true,false,false,true,null,null,null);
    nodeInfo.addAttribute("Applid", "com.sap.dictionary.string");
    nodeInfo.addAttribute("Apptext", "com.sap.dictionary.string");
    IWDNode node = wdContext.wdGetAPI().getRootNode().getChildNode("demo",IWDNode.NO_SELECTION);
      for(int i=0; i<wdContext.nodeEt_Mobileportal().size();i++)
         IWDNodeElement nodeElem = node.createElement();
         nodeElem.setAttributeValue("Applid", wdContext.nodeEt_data().getEt_dataElementAt(i).getApplid());
         nodeElem.setAttributeValue("Apptext", wdContext.nodeEt_data().getEt_dataElementAt(i).getApptext());
         node.addElement(nodeElem);
    In domodify method,
        if(firstTime)
           IWDTransparentContainer cont= (IWDTransparentContainer)view.getElement("menu");          
           for( int i=0; i<wdContext.nodeEt_Mobileportal().size(); i++)
           IWDLinkToAction link  = (IWDLinkToAction)view.createElement(IWDLinkToAction.class,"link"+i);
                  link.setText(wdContext.nodeEt_Mobileportal().getEt_MobileportalElementAt(i).getApptext());
           link.setOnAction(wdThis.wdGetGotoappAction());                    
           cont.addChild(link);
    Thanks,
    Mugundhan

  • How to delete dynamically created attribute

    Hi,
      I am creating table dynamically according to no of columns. first time its displaying correctly, second time once i changed the no of columns its throwing error message like:
    com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(DynamicView.TableNode): duplicate name for attribute name0.
    Everytime before creating table i tried  following commands.
    table.removeAllColumns();
    but still i am getting error.
    Help me out in this....
    Regards
    Suresh KB

    hi suresh
    table.removeAllColumns();
    will remove all the columns from the view.
    but when u create the context attributes they are already existing. So it is giving the duplicate context exception.
    To solve this problem, first delete all the attributes created dynamically. using below code.
    wdcontext.node<urnode>().reset(<b>False</b>).
    it will delete all the attrbutes created at runtime.
    to delete attrbutes created at designtime use.
    wdcontext.node<urnode>().reset(<b>True</b>).
    Regards
    Brahmanandam.A
    collections created at design time will be preserved.  All dynamically
    added nodes and attributes are destroyed from the metadata.<p>
    Calling reset(true) is functionally equivalent to calling reset().<p>

  • How to access custom property for attribute and control in .vm file?

    Hi,
    I have created custom properties in OPM for attribute and apply also that properties to attribute.
    But if how to access that value in .vm file?
    I accessed using
    $attribute.getProperty("ScreenProp", "default value")
    but it's not working but same is worked for screen custom property

    $control.getProperties().get("PropertyName") works for custom properties on a control
    If you output $control and $control.getProperties() to the html you can lookup the API for the used classes.
    I can't give an example of the html because it's stripped in this forum
    Edited by: Peter van de Riet on 20-mei-2011 14:18

  • How to access Business object type attribute from a method/function modul ?

    Hello,
    i have created a business object type object along with attributes and methods. Now inside the method i want to access the attributes. inside the method i am writing:
    data a type XXX.
    a = me->attribute
    this is creating a compilation error.
    Now the method is defined as a function module in some package, so can anyone inform me how to access object attributes from the function module ?
    pointes are awarded
    Regards

    Hello,
    thanks for your answer, but this too did not work, "=>" is for static attributes and the attributes i have are not static. Moreover, i tried it but it gave the same error :
    the abap error was when i was checking the code is :
    the type me=>documenttype is unknown
    as you know in SWO1 i created an object and when i create a method you link it to a function module and this is where you have the implementation of the method, so from this method how can i access the attributes on the main object that i created in SWO1
    regards

  • How to access a Plan created in Enterprise Link Design Studio

    I have created a Plan in Design Studio of Enterprise Link and i would like to put it in a report which i am planning to create using BAM active studio. Can some body tell me how to access things created in Enterprise Link from active studio/architect.

    hi
    You have to create a plan to connect to the external message source, get the message and parse , and finally put it in the ADC data object (user created object). After this step, all your incoming messages will be in ADC data object. Only after getting the message into ADC object, you can use this object - you can create reports using this object.
    I have a few questions
    a) Can you identify your company. b) Have you taken the BAM training course c) These steps are given in training documents in lab 2-6 step by step.
    Do let me know if you need any help, contact directly at [email protected]

  • How to delete a dynamically created context node ?

    Hi
      I have created a context node dynamically and have added the check boxes to the node.
      But when i am refreshing the page it is giving me the following excepiton:
    com.sap.tc.webdynpro.progmodel.context.ContextException: DataNodeInfo(DwdReportView.Person): duplicate name for attribute attr1
    I am writing the following code in wdDoExit() method so that the node is invalidated  and all dynamically added nodes and attributes are destroyed from the metadata.
    The code  is :
         wdContext.getContext().reset(false);
    or
         wdContext.getContext().reset();
    or
                         wdContext.nodeName().invalidate();
    I have tried all the above mentioned code  snippets but it is still giving me the same exception.
    Please help me  resolve this issue.
    Thanks in advance.
    Regards
    Shaily

    Shally,
    A better forum to place your question is the forum.
    To your question: the wdDoExit() method is only called once i.e. when the view is destroyed from memory. Just like the wdDoInit() mehtod is called only once at initialisation of the view.
    Try refactoring your code, so that upon initialising of your context, the old version of it is removed.
    Hope this helps.
    Regards,
    Alain

  • How to access OS User created with "identified externally"

    I am able to
    SQL> create user ops$deskuser identified externally;
    while deskuser is one of my OS user.
    I believe it is a very easy question, however I just do not know how to access this user from sqlplus., please help
    Thanks in advance

    oracle@mini:~> sqlplus system
    SQL*Plus: Release 10.1.0.3.0 - Production on Sun Nov 13 21:11:47 2005
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Enter password:
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL> create user ops$pops identified externally;
    User created.
    SQL> grant connect to pops;
    Grant succeeded.
    SQL> exit
    Disconnected from Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    oracle@mini:~> su - pops
    \Password:
    Illinois isn't exactly the land that God forgot -- it's more like the
    land He's trying to ignore.
    pops@mini:~> . oraenv
    ORACLE_SID = [pops] ? orcl
    pops@mini:~> sqlplus /
    SQL*Plus: Release 10.1.0.3.0 - Production on Sun Nov 13 21:16:59 2005
    Copyright (c) 1982, 2004, Oracle. All rights reserved.
    Connected to:
    Oracle Database 10g Enterprise Edition Release 10.1.0.3.0 - Production
    With the Partitioning, OLAP and Data Mining options
    SQL>

Maybe you are looking for