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

Similar Messages

  • 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 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

  • Restricting values on the drop down list, while creating a PO

    Hello SAP Experts,
       Could you help me with the following.
      While creating a PO (ME21N), based on the Account Assignment Category(KNTTP) entered , I have to restrict the values in the drop down list for selecting the material group (MAKTL). I have searched some in SDN, but couldn't find anything suitable. Appreciate any help.
    Thank you,
    Sorab

    Could anyone tell me , if it is possible. Has anyone tried this before.
    Thank you,
    Sorab

  • Display pages that reacts to different values in the drop down list.

    I currently did up a simple drop down list that stores values retrieved from the database. I would like the program to display pages that reacts to the selected value without the press of any button, which means, if I select any value from the drop down list, the page will be displayed according to the value selected.
    Below are the codes that I did for the retrieval of data from the database.
    <%
            String username = "test";
            String password = "test";
            String thinConn = "jdbc:oracle:thin:@dbdev:1521:ORCL";
            Connection conn;
            Statement stm;
            ResultSet rs;
            String baseQuery ="SELECT DISTINCT ID FROM STAFF ORDER BY ID ASC";
            try {
                conn = DriverManager.getConnection(thinConn,username,password);
                stm = conn.createStatement();
                rs = stm.executeQuery(baseQuery);
    %>
    <strong>Retrieve ID from Database</strong>
        <select size="1" name="dropdown">
        <%
        while (rs.next()) {
            String id = rs.getString("ID");
            out.write("<option value=\"" + id + "\">" + "level " + id + "</option>");
                    conn.close();
                } catch (SQLException e) {
        %>
        </select>Would appreciate if someone might offer some help to what I have to do next
    Edited by: wyndsor on Jun 26, 2008 7:34 PM

    cotton.m wrote:
    [_An instant classic_|http://www.webdeveloper.com/forum/showthread.php?t=184937]
    Sometimes I find myself wondering why people think they won't get caught with their cross forum cross posting. Then I realize that if they knew about Google they wouldn't have needed to ask the question in the first place.
    It's kind of funny in an ironic sort of way.

  • How to set a default value for a drop down list box and then apply cascading based on the default value in Infopath 2010.

    Hello Everyone
    I have two drop downs. Both are coming from look up fields from two lists. i want to set a default value(first list item) for the first drop down list box and then apply cascading based on the default value for the next drop down list box. I found one article(http://www.bizsupportonline.net/infopath2010/display-first-item-drop-down-list-box-infopath-2010.htm)
    where in i can set a default value but i can't apply cascading based on that default value. Any suggestions would be highly appreciated.
    Thanks
    Ramanjulu Naidu N

    Hey Ramanjulu,
    Take a look at the below article which I believe will answer your question.
    http://basquang.wordpress.com/2010/03/29/cascading-drop-down-list-in-sharepoint-2010-using-infopath-2010/
    Daniel Christian (MCTS)

  • Problem in getting the current value of the drop down while calling value change listener

    I have 2 drop down list. I am trying to get the value of first drop down from other drop downs value change listener. Initially one drop down contains a default value. First time I got the value while calling the value change listener. But if I change the default value to other in the first drop down and call the value change listener of the second drop down then I got the old value in the bean. Can anyone suggest a process

    If I use the following code it gives me the current index.
                valueChangeEvent.getComponent().processUpdates(FacesContext.getCurrentInstance());
                System.out.println(valueChangeEvent.getNewValue());
    This is also giving me current index.
    BindingContainer container = BindingContext.getCurrent().getCurrentBindingsEntry();
    AttributeBinding attrIdBinding = (AttributeBinding)container.getControlBinding("PersonTypeId1");
    if(attrIdBinding.getInputValue()!=null)
                   System.out.println(attrIdBinding.getInputValue().toString());
    But at last I got some help from Shay Shmeltzer's Weblog.
    BindingContainer bindings =
                    BindingContext.getCurrent().getCurrentBindingsEntry();
                    // Get the sepecific list binding
                    JUCtrlListBinding listBinding =
                    (JUCtrlListBinding)bindings.get("PersonTypeId1");
                    // Get the value which is currently selected
                    Object selectedValue = listBinding.getSelectedValue();
                      long value =0L;
                    if(selectedValue!=null){
                        System.out.println("Sudip.. Person Type using bindings"+selectedValue.toString());
    But this returns "ViewRow [oracle.jbo.Key[300000860721156 ]]"
    300000860721156 is the original value.. Would you please help me to figure it.

  • How to set default value for a drop down in Mobile Application Studio

    Hi,
    We have a requirement in which for a drop down - Transaction type (Activities), the value should be defaulted to 'Visit' and the Activity Category should be 'Sales Visit'. I tried debugging the code and got the piece of code where this value is referred, but i'm unable to find out the location where this value is picked from. Also while opening up the properties corresponding to this, there is a default value tab in the properties pane. I tried by giving this default value, but didn't work. When I'm trying to revert the changes i've made in the property, it is showing up an error.
    Any pointers on this would be of great help.
    Thanks in advance,
    Rasmi.

    Hi Rasmi,
    You can default the process type field of BOACTIVITY by different ways-
    1.In BOL, business object BOACTIVITY loaded event, check the parameter bIsNew and then default the value of process type if you want it only for new activities.
    Other attributes currently get defaulted in the attributechanged event of BOACTIVITY where field is processtype.So if processtype is defaulted it will try to default other attributes based on that.It will pick values from the customizing maintained in SPRO->CRM->Transactions->Basic Settings->Define Transaction Type->Customizing Header.
    2.You can also do defaulting in the UI.If you want to default one field based on a value selected for drop down, then write the code in the onselected2 event of the drop down.
    In your specific case, best way is to use option 1.
    Regards
    Vivek

  • Setting default value in dynamic drop-down menu

    Hi,
    I created a simple drop-down menu that can be used to edit an
    existing record or to create a new record.
    When creating a new record, I'd like the drop-down menu to
    display "Not specified" by default. Could anyone help me with this?
    The "Not specified" option in the drop-down menu should refer
    to record ID 11 in my database table entitled "names".
    Here's what my code looks like so far.
    The db queries:
    <CFQUERY DATASOURCE="DATA" NAME="get">
    SELECT *
    FROM names
    order by name
    </CFQUERY>
    <CFQUERY DATASOURCE="DATA" NAME="quo">
    SELECT *
    FROM quotes
    WHERE quoteID = #quoteID#
    </CFQUERY>
    This part is for the existing database record:
    <select name="frn_ID">
    <cfoutput query="get">
    <option value="#id#"<cfif id is quo.frn_ID>
    selected</cfif>>#name#</option>
    </cfoutput>
    </select>
    Here is where I'd like the ID with a default value of 11 to
    be displayed:
    <cfelse>
    <select name="frn_ID">
    <cfoutput query="get">
    <option value="#id#">#name#</option>
    </cfoutput>
    </select>
    </cfif>
    Thank you for any help with this!
    Luke

    Thank you.
    I added this line:
    <CFSET ThisOne = 11>
    and then edited the drop-down menu to appear like this:
    <select name="frn_ID">
    <cfoutput query="get">
    <option value="#id#" <cfif ThisOne is ID>
    selected</cfif>>#name#</option>
    </cfoutput>
    </select>

  • Default values for dependent drop down menu

    Hi!
    I did create an insert record page that lets the user put in information using text fields. In addition the form has a dependent drop down menu for a category and then depending on the chosen category, the user is presented with choices in a second drop down menu for subcategories.
    The insert of the record itself works fine.
    The records are then listed in a table. A link to a details page should then list all fields of a chosen record. I have another form sporting them dependent drop down menus again. Since I retrieve a record from the database I would like to have the drop down menus default to the values stored in the database.
    But whatever I tried the menus always default to the respective first entries in each menu.
    I tried to use the "select value equal to" field in the "insert record" for the category and the "Default detail value" field in the dependent drop down item for the subcategory field.
    Any pointers anybody?
    Thanks in advance
    Juergen

    Hi there I cannot understand your request fully but I think I understand....
    I think I have done nearly exactly what you need
    I will try to explain
    for a start I am working on a art gallery site that has many different artists and many different paintings
    I am able to add a new artist and have that artist name appear automatically in a dropdown menu on my add painting form page so that when I add a new painting I do not have to type the arrtists name every time
    I am not sure this is what you need but I think maybe....
    (i have another site that displays different categories of jewellry... with a form that has same dropdown and can choose product category.... but the process is the same)
    the way I did it was to first create an 'artist_info' table in my database and an 'add artist page' pretty simple
    Then an painting_pnt table in my database and an 'add painting' page with a form that contains a dropdown menu that is dynamically populated from the artist_infotable... label from the artist_name field value from the artist_id field so the form uses two recordsets.......
    Then in my painting_pnt table I have a field that stores the artist_id
    So when I add a new artist..... the name automatically appears in the dropdown menu when I add a new painting I choose the artist name and then later I can filter recordsets on my detail pages using the id_artist....
    there is a lot more to it as well but that should get you started
    I hope this helps
    If you have any questions at all I will try to explain better
    takiteasy

  • How to populate the values in the drop down list form the xml file ?

    I want to populate the drop down list values from a seperate xml file called ReferenceData. I created this file, which consists of a mapping entry in the form of ( key,value ) pair. Am mapping this xml file in to form by using rule named as getAppReferenceData.
    But the values are not getting populated in the form. And I have a doubt of, where should we keep that xml file? (under which path / folder ).

    what would help is if you showed what you do in the rule, either the code or a express trace of the rule.
    The other thing you need to know is where you want to get the file from. Yes java can read a file from anywhere on the system but there is a security layer in there which might prevent the file being opened. Have you allowed acces to the file via the security policy settings via java.io.FilePermission?
    WilfredS

  • How to make default value in a drop down list

    Hi,
          I have created a drop down list using Selection-Screen code. I have three values in it. I would like to make one of the option as a default value. How to achieve it?
    I am working on module pool program. I have few screens as a part of my program. I have created print button on tool bar of one screen but that print button is appearing on the other screens too. How to avoid it?
    Help would be appreciated...
    Thanks
    Edited by: mohammed ibrahim on Oct 10, 2008 8:43 PM

    1) let drop down box be g_dd.
      if g_dd is initial.
      g_dd = option2.
      endif.
    2)
    by default same pf-status is used by all the screens in the same program
    if sy-dynnr = 'screen_no'. " for screens for which you do not want button to come
    set pf-status 'abc' excluding 'fcode_of_button'
    endif.
    or
    data: git_fcode type sy-ucomm with header line.
    git_fcode = 'fcode_of_button'.
    append git_fcode.
    if sy-dynnr = 'screen_no'. " for screens for which you do not want button to come
    set pf-status excluding git_fcode
    endif.
    Edited by: Amit Gupta on Oct 11, 2008 11:36 AM

  • How can I remove the by-default text in the drop-down box in a fill-in-the-blank answer?

    I have this text in English "Select" for each drop-down list that is big enough:
    It appears in French at my project manager's place (in France).
    Question 1: Can we remove that text totally?
    Question 2: How can I make sure it will only appear in English?
    Many thanks

    I found it myself how to do it. The error says that it is not able to find the reference object i.e  it is asking us to refer to the table. The following piece of code will solve this problem. Have to implement this in WDDOMODIFYVIEW method of the view. This thing works comrades enjoy...
      DATA : lr_cmp_usage TYPE REF TO if_wd_component_usage,
             lr_if_controller  TYPE REF TO iwci_salv_wd_table,
             lr_cmdl   TYPE REF TO cl_salv_wd_config_table,
             lr_col    TYPE REF TO cl_salv_wd_column.
      DATA : node_year  TYPE REF TO if_wd_context_node,
             elem_year  TYPE REF TO if_wd_context_element,
             stru_year  TYPE if_alv_layout=>element_importing,
             item_year  LIKE stru_year-i_current_year,
             lf_string    TYPE char(x),
      DATA: lr_column TYPE REF TO cl_salv_wd_column.
      DATA: lr_column_header TYPE REF TO cl_salv_wd_column_header.
      DATA: lr_column_settings TYPE REF TO if_salv_wd_column_settings.
    Get the entered value from the input field of the screen
    node_year  = wd_context->get_child_node( name = 'IMPORTING_NODE' ).
    elem_year  = node_year->get_element( ).
      elem_year->get_attribute(
       EXPORTING
        name = 'IMPORT_NODE-PARAMETER'
       IMPORTING
        value = L_IMPORT_PARAM ).
      WRITE L_IMPORT_PARAM TO lf_string.
    Get the reference of the table
      lr_cmp_usage  =  wd_this->wd_cpuse_alv( ).
      IF lr_cmp_usage->has_active_component( ) IS INITIAL.
        lr_cmp_usage->create_component( ).
      ENDIF.
      lr_if_controller  = wd_this->wd_cpifc_alv( ).
      lr_column_settings = lr_if_controller->get_model( ).
    get column by specifying column name.
      IF lr_column_settings IS BOUND.
        lr_column = lr_column_settings->get_column( 'COLUMN_NAME').
    set Header Text as null
        lr_column_header = lr_column->get_header( ).
        lr_column_header->set_text( lf_string ).
    endif.

  • 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

Maybe you are looking for

  • System Compression option not showing up in Disk Cleanup tool

    I am trying to give the new "System Compression" option in cleanmgr a spin but for some reason it is not showing up on my system. I have installed Windows 10 TP into a small partition on an eSATA hard disk, leaving my internal HDD for Windows 7, if t

  • Paypal payment pending

    Hello! I bought intel server motherboard as a guest from best buy website. I managed to pay by paypal but when I was redirected to best buy website for authentication my internet went down and the page froze. In my paypal it says that the payment is

  • How to maintain BNKA table.

    Hi, I have a requirement to Maintain the table BNKA, where i can able to change the selected entries of the table. This we can do normally by creating the maintainance view for the table. This case we cannot as this is a standard table. Could you ple

  • How to make priceing procedure in outgoing tax

    hi Please explian step by step how to make the pricein procedure in outgoing tax

  • Customer DB - standard vs enterprise

    Was wondering if anyone has installed Portal into a standard edition customer DB? We currently have our installed in a Enterprise Edition and were wondering if it was really necessary. If someone has, what were the pitfalls? Thanks, Melissa