How to populate values in to drop down by index

Hi in my application  i have dropdownby index with label State.In that dropdown i need to populate all the states of our country like..Tamilnadu,andhraprdesh,Gujrath,Maharastra,Delhi....,and by default it should be populated with Select State ,can u please tell me the code..
Thanks
Kishore

hi,
1.in ur context create a context value node----eg: MyStates
2.under that value node create a value attribute--eg: values.
3.set the cardinality of "MyStates" value node to 0:n
4.texts property of ur dropdown by index ui element shld be bound to the value attr (values).
5.in the wdDoInit() method of ur view that has this dropdownbyindex ui element use the follwoing code,
String    [  ]    states_array    =        new String [  ]   {"tn", "mp", "ap", "karnataka"};
List list_for_node_elem = new ArrayList();
   for (int i =  0; i <states_array.length; ++i)
      IPrivateMyView.IMyStatesElement elem = wdContext.createMyStatesElement();
      MyStatesElement.setValues(states_array   [i ]   );
      list_for_node_elem.add(MyStatesElement);
   wdContext.nodeMyStates().bind(list_fornode_elem);
   wdContext.nodeMyStates().setLeadSelection(1);
Regards
Jayapriya

Similar Messages

  • 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

  • How can I add values on a Drop Down by Index Webdynpro Element?

    Hi every body
    Can anybody help me?
    How can I add values on a Drop Down by Index Webdynpro Element?
    How can I invoque my element on the Implementation Webdynpro?

    Hi Jesus,
    You can add elements to your DDbyIndex like this:
    //Example: Popular un Dropdown by Index usando Nodos de contexto  
    // NODE[Card: 1..n, Sele:1..1]  Si es obligatorio;            ||    NODE[Card: 0..n, Sele:0..1]  Si no es obligatorio y se puede dejar en blanco
    //Assuming we created a node called "Source", with a string attribute called "Texto" binded to the dropdownbyindex
    for (int i = 1; i <= 101; i++)
         ISourceElement sourceElement = wdContext.createSourceElement();
           sourceElement.setTexto("Text number "+i);
           wdContext.nodeSource().addElement(sourceElement);
    Regards.
    Julio Herrera

  • How can I add values on a Drop Down by Index Webdynpro Element by a Model?

    How can I add values on a Drop Down by Index Webdynpro Element with a Model RFC?

    Hi Jesus,
    Please use the below code for DropDownByIndex Elements :-
    Suppose you have model node ABC and attribute xyz. Now you have created custom node CustNode and attribute CustAtt.
    ICustNodeElement  ele = null;
    if(wdContext.nodeABC().size > 0)
                  for(int i=0; i< CustNode< wdContext.nodeABC().size; i++
         ele = wdContext. createCustNode();
                          ele.setCustAtt(wdContext.nodeABC().getABCElementAt(i).getXYZ)
         wdContext.nodeCustNode.add(ele);
    Refer to http://help.sap.com/saphelp_nw70/helpdata/en/3b/f1754276e4c153e10000000a1550b0/frameset.htm
    Best Regards
    Arun Jaiswal

  • How to populate data from dynamic drop down list to the text field

    Hi,
    I tried to populate data from dynamic drop down list to city field. I would like to concat data from drop down list.When selecting add button to add the item and select item from drop down list, data should be displayed in the text field. However, Please help. I spent alot of time to make it works I am not successful.
    Please see the link below.
    https://acrobat.com/#d=SCPS0eVi6yz13ENV0cnUdw
    Thanks for your help
    Cindy

    Hi Rosalin,
    Loop the hidden table, get the values and populate drop down in each iteration.
    DropDownList1.addItem("Text","Value");
    You can use one more solution for this scenario. If it is a matter of 2,3 dropdowns, put three dropDowns in the form layout and give seperate static data binding to them. At run time make the dropDowns hide/visible as per the requirement.
    Hope this helps.
    Thanks & Regards,
    Sanoosh

  • How to get value in Second Drop Down based on selection made in first dropd

    Hi All,
    I have a table with first two columns as dropdown.
    The values in first drop down are fixed. However the value in second dropdown should be populated based on selection made in first .
    e.g
    First Column had different departments say IT, SALES, HR.
    Based on department selected I have to populate employee of that department.
    For first dropdown I have taken Drop down by index.
    What should I select for second drop down and achieve desired functionality? Please guide.
    Regards,
    Madhvika

    Hi
    Use drop down by key for fixed values IT, SALES, HR. create on_select action for that drop down.
    in on_select method code like this..
      DATA lo_nd_segment1 TYPE REF TO if_wd_context_node.
      DATA lo_el_segment1 TYPE REF TO if_wd_context_element.
      DATA ls_segment1 TYPE wd_this->Element_segment1.
      data lt_segment1 type wd_this->elements_segment1.
      DATA lv_segment TYPE wd_this->Element_segment1-segment.
      data lr_column type ref to cl_wd_table_column.
    navigate from <CONTEXT> to <SEGMENT1> via lead selection
      lo_nd_segment1 = wd_context->get_child_node( name = wd_this->wdctx_segment1 ).
    get element via lead selection
      lo_el_segment1 = lo_nd_segment1->get_element( ).
      lo_el_segment1 = WDEVENT->GET_CONTEXT_ELEMENT( 'CONTEXT_ELEMENT' ).
    get all declared attributes
      lo_el_segment1->get_static_attributes(
        IMPORTING
          static_attributes = ls_segment1 ).
    now ls_segment1 contains your first drop down selection value.
      DATA : lv_dropdown type string .
      lv_dropdown =  ls_segment1-segment.
      if lv_dropdown = 'IT'.
    // here fill your second drop down based on IT value.
    endif.
    Hope it solves.
    Cheers,
    Kris.

  • Default value in the drop down by index

    Hi Experts,
    I have a drop down by index to which i binded one internal table,but m not able to get the default value
    i want the first value to be selected in the drop down by default,Pls give me suggestion for solving this problem

    Hi Shan,
    As per your requirement,When ur binding the internal table to the  drop down by index ,but your are not able to get the default value.
    For this please check this code.
    In this I hv taken a node - dropdown1 and within this attribute of type Land1 and I hv set the cardinality to 0..n.
    Then I hv bind the text property of the dropdownbyidx ui element to the node attribute.
    then i hv call this code in the init method of view.
    DATA lo_nd_dropdown1 TYPE REF TO if_wd_context_node.
      DATA lo_el_dropdown1 TYPE REF TO if_wd_context_element.
      DATA lt_dropdown1 TYPE wd_this->elements_dropdown1.
      DATA ls_dropdown1 LIKE LINE OF lt_dropdown1.
      navigate from <CONTEXT> to <DROPDOWN1> via lead selection
      lo_nd_dropdown1 = wd_context->get_child_node( name = wd_this->wdctx_dropdown1 ).
      @TODO handle not set lead selection
      IF lo_nd_dropdown1 IS INITIAL.
      ENDIF.
      get all declared attributes
      lo_nd_dropdown1->get_static_attributes_table(
        IMPORTING
          table = lt_dropdown1 ).
      SELECT land1 FROM t005 INTO CORRESPONDING FIELDS OF TABLE lt_dropdown1.
      CALL METHOD lo_nd_dropdown1->bind_table
        EXPORTING
          new_items            = lt_dropdown1
          set_initial_elements = abap_true .
    Regards
    Manoj Kumar

  • How to use value in a drop-down list box as "With these Values" parameter?

    Hello, new user.
    I have a drop-down list box on Page 1, upon which the user can choose a study number. The List Box is named "P1_STUDY_NBR".
    Then I have a list, one entry of which goes to my master-detail form, which is Page 6. I would like it to go to the study number that the user choose on Page 1.
    In my target on the create/edit list entry, I put in "Page in this Application", "Page 6", then in Set these items, I put in
    P6_STUDY_NBR
    My question is what to use in With these values, where I want the contents of the P1_STUDY_NBR. I tried:
    &P1_STUDY_NBR
    and that does not work. If I put in one of the study numbers, like 336-00, then it does work, but I want it to pass the study number the user chooses in the list box. How do I refer to the contents of P1_STUDY_NBR?
    -Mary

    Yes, that does work, thanks. I'm now getting the default value I was putting in yesterday rather than an error message, so there must be something loading it, but I'll hunt around for what process might be doing that, or try re-creating the master-detail form again.

  • How to remove values from a drop down menu with personalizations

    I have been unable to find any examples of removing values from a dropdown menu using forms personalizations. We have a specific responsibility that we would like to limit the actions that they can carry out on the person form. I have tried setting default values, setting the object to update_allowed = false, and have been unable to come up with a solution. The examples I have found do not show this type of personalization so I am unsure if it can be done. If anyone has done a personalization like this, please post the steps to reproduce or a link to an example. Thanks.

    DineshS wrote:
    Which dropdown menu you want to customized ?The specific menu we would like to customize is the 'Action' menu on the Person form that usually contains 'Create Employment' and so on. We have a specific recruiter responsibility that we would like to limit to 'Create Applicant'. I have been unable to come up with a combination of steps in personalizations that sets that value in the dropdown and allows it then be unchangeable. If you have any suggestions, please let me know. I would prefer not to create a custom form but without personalizations, I might have to.

  • In Drop Down by Index how can i pass default value Dynamically

    Hi Friends,
    In Drop Down by Index how can i pass default value Dynamically.Please help me.
    Thanks in advance.
    Regards,
    Kumar.

    hi,
    if you want the value to be defaulted only the first time you execute the program then write the code which suman has mentioned in the views method
    wddoinit.
    Regards
    Sajid

  • How to set a Default Value in the drop down on Account Creation ?

    Hi,
    i have to set a default value in the drop down as soon as a User in a particular business role clicks on New Account. I have written the following code in do_prepare_output method. But this code is executed in the 2nd server round trip after entering some value or pressing enter. so i am not getting as soon as user clicks on the New Account.
    How to set that default value when user clicks on New Account ? and where should i code ?
      IF lv_icwc_profile = 'ZCSALESPRO' or lv_icwc_profile = 'Z_SALESPRO' .
      try.
                  lr_entity ?= me->typed_context->header->collection_wrapper->get_current( ).
                  lv_current = lr_entity->create_related_entity(
                                                  iv_relation_name = 'BuilRolesRel' ).
                                 lv_current->set_property(
                                    iv_attr_name = 'PARTNERROLE'
                                    iv_value     =  'BUP002' ).
                   CATCH cx_sy_ref_is_initial cx_sy_move_cast_error
                   cx_crm_genil_model_error.
                   return.
            ENDTRY.
    Thanks and Regards
    Raman Khurana

    Hi,
    I have some idea abt it, it is also used in account life cycle.
    Please refer SAP note 1097651, Defaulting a life cycle stage.
    Let me know if useful.
    rgds,
    Vinay

  • How to hard code values in drop down by index

    Hi everyone
    I hav a node containing 2 attributes ie value n key. I am using drop down by index.  Value attribute is bound to my drop dwn box. In key I am providing key value for the value.  I need to hard code 3 value..Can anyone help me how to do so.
    Thanks
    Jaspreet Kaur

    Hi,
    Example for Data Binding of the DropDownByIndex UI Element:
    Procedure at design time:
           1.      Create a view with the name TestView.
           2.      Insert the DropDownByIndex UI element as a container child of the TestView view. (Step 1)
           3.      Create the context structure, as described in step 2.
    Create the context node X with the cardinality 0..n. Insert the value attribute y of the type String into this node. Then perform the data binding of the DropDownByIndex UI element in the Properties window of the View Designer. The texts property must be bound to the value attribute y with the context path description TestView.X.y (step 3).
    The context path TestView.X.y describes the attribute y in the context node X of the view context of the TestView view.
    You can fill the context with test data using the following controller implementation.
    public void wdDoInit()
        //@@begin wdDoInit()
       String[] letters = new String []
       {"A", "B", "C", "D"};
    //Create context elements for the node "X"
       List nodeElements = new ArrayList();
       for (int i =  0; i <letters.length; ++i)
          IPrivateTestView.IXElement xElement = wdContext.createXElement();
          xElement.setY(letters<i>);
          nodeElements.add(xElement);
    //Bind node element list to the node
       wdContext.nodeX().bind(nodeElements);
    //Set node’s lead selection which determines the selected item
       wdContext.nodeX().setLeadSelection(1);
        //@@end
    Regards
    Ayyapparaj

  • How to capture selected value from drop down by index

    Dear friends,
    i want to capture the value of select value from drop down by index, for eg if  select air france, how to capture , could any one please let me know
    Thanks
    Vijaya

    Hi Vijaya,
    You can get the value of selected from drop down as below
    Check out the event handler method attached to Onselect event of the ui element drop down by index , if no event is associated, then create an event and attach to the drop down list
    Now you will be having the CONTEXT_ELEMENT in the WDEVENT parameter
                   data lo_element type ref to if_wd_context_element.
                   lo_element = wdevent->get_context_element( name = 'CONTEXT_ELEMENT').
    Now, you can get the static attribute value of selected  drop down value & let us say your drop down list values are populated from context node 'ND_DRP_DOWN'
                   data ls_data type wd_this->element_nd_drp_down.
                             lo_element->get_static_attributes(
                                       importing
                                       static_attributes = ls_data ).
    Hope this helps you.
    Regards,
    Rama

  • How to add customized value to drop down by index binded to model attribute

    i have to Ui element Drop down by index to which i have binded model attribute for populating the values, now i want to add a customized value to it like "choose all".
    how can i do this ??
    Thanks and regards,
    Aditya Deshpande

    Create a value node similar to model node. In value node you can add element at the index wherever you want to:
    wdContext.node<nodename>().addElement(<index>,<element>);
    Regards,
    Murtuza

  • Populate Values for Drop Down by Index in Table in Web Dynpro Java

    Hi Experts,
    I have a table and having a column table cell editor as Drop Down by Index.
    I have created the table node (tbnode) and child node for DDBI (ddbinode) and set the singleton property for DDBI node to false.
    I have same local variable node as same as above node and the values are available.
    I have one button ADD.On click the add button i need to populate the values to table node and as well as DDBI Node.
    I created supply function for DDBI node and populate the values for DDBI Node.
    Add Method:
    IPrivateMdTest8CompView.ItbnodeElement tbnode = wdContext.nodetbnode().createtbnodeElement();
    tbnode.setDescription(wdContext.currentCn_LocalVariableElement().getDescription);
    wdContext.nodetbnode().addElement(tbnode);
    Supply Function Method:
    for(int j=0;j<wdContext.nodetbnode().size();j++)
    wdContext.nodeddbinode().setLeadSelection(j);
    IPrivateMdTest8CompView.IddbinodeElement ddbinode = wdContext.nodeddbinode().createddbinodeElement();
    ddbinode.setddvalue(wdContext.currentCn_localddvalueElement().getddvalue);
    wdContext.nodeddbinode().addElement(ddbinode);
    Problem is one i got the values in the drop down and i click the second row in table again the supply function calls and reset the first row drop down to original value.
    If you any problem like please provide the solution.
    Thanks & Regards,
    SatheshKumar R

    If you created the supply method by setting the supply property of the node, you should have variable 'node' available as argument of the supply method, which will be related to the table row of the triggered dropdown. Opening the dropdown does not change the lead selection of the parent node, so
    ddbinode = wdContext.nodeddbinode().createddbinodeElement();
    wdContext.nodeddbinode().addElement(ddbinode);
    does always relate to the first row of the table (given that leadSelection == 0). With the node variable you can
    IddbinodeElement ddbiElement = node.createddbinodeElement();
    node.addElement(ddbiElement);

Maybe you are looking for

  • Valuated stock for a certain period

    Hi all, Using transaction MC.9 (Material Analysis: Stock), you can search for a material for a certain period (ea. 04.2007). The outcome gives you the Valuated Stock for that period. In which table is this Valuated stock stored? How can I fetch this

  • How to search for the url in a hyperlink.

    Is it possible to search a PDF and find the url in a hyperlink? According to Adobe, no! But is there some third party software? We are attempting to find a url in many PDF's but the hyperlink could have many different naming styles. Is there a way to

  • EDI to Flatfile Conversion

    Hi all! I am new in SAP XI. And i am researching on how will I convert EDI (SLSRPT) to a flatfile. Can everybody advise me on how will I handle this? I can convert EDI to XML using Seeburger Adapter, and from XML, I will convert it to Flatfile. The c

  • What IDE you guys can recommend?

    I basically use this programming enviornment: JDK+Emacs+Other shell tools. It works very fine and productive to me. However, I would like to try some IDE now since at this moment, I need to do a lot of things on visual looking. I think IDE might help

  • Using Bootcamp: Windows 7 won't launch, goes to black screen.

    21.5-inch, Mid-2010 iMac, running OSX Mountain Lion, v. 10.8.2 I currently have Bootcamp running Windows 7, for some windows specific programs. Last night, while using windows, I was prompted to install some updates. One of which required a system re