DropDownListByKey

Hi,
I have a DropDownListByKey based on SVS. I would like that on the white space of the combo-box, instead of default value or while space, it will be written 'Select' and the user will select one of the values of within the combo box.
What I can do is to add the value 'Select' to the values list and set this value as the default value.
Is there any other way to do this such that the 'select' value will <u>not</u> appear as a value that can be selected in the combo-box?
Thanks in advance,
Aviad

Hi Aviad,
Write in init
   wdContext.currentContextElement().setattribute1("<Select>");
Where attribute1 is the attribute bound to the selectedkey in dropdown
This is to fill the other values
IWDAttributeInfo attinfo = wdContext.getNodeInfo().getAttribute("attribute1");
ISimpleTypeModifiable modinfo = attinfo.getModifiableSimpleType();    IModifiableSimpleValueSet valset = modinfo.getSVServices().getModifiableSimpleValueSet();
valset.put(key,text)
Regards
Rohit

Similar Messages

  • How to define the texts for UI element Dropdownlistbykey?

    Hi everyone,
      I don't know how to define the texts for Dropdownlistbykey. It seems that Dropdownlistbykey has an attribute "selected key", but where can I bind the texts I want to display when user clicks the downwards
    arrow?
    Thanks in advance.

    hi,
    you can use this code :
    method WDDOINIT .
      DATA : node_info TYPE REF TO if_wd_context_node_info,
             value1 TYPE wdy_key_value,
             set TYPE wdy_key_value_table,
             k1 type string value 'M',
             v1 type string value 'MAGO',
             k2 type string value 'S',
             v2 type string value 'Saurav'.
      value1-key = k1.
      value1-value = v1.
      APPEND value1 to set.
      value1-key = k2.
      value1-value = v2.
       APPEND value1 to set.
    node_info = wd_context->get_node_info( ).
    node_info = node_info->get_child_node('FOR_DROP').
    node_info->set_attribute_value_set( name = 'DROP_KEY'   value_set = set ).
    I hope it helps.
    Thanx.

  • DropDownListByKey cahnge fires to fill another DropDropDownByKey

    Hi,
    I'm developing webdynpro java application.
    a view in application contains 2 DropDownByKey.
    First DropDownListByKey filled in component controller (Via context element).
    When first DropDownListByKey's selected value changes, second DropDownListByKey must fill (in View, via context element).
    I did 1st DropDown filled successully at component controller, but problem about second DropDown (in view).
    Second DropDown must fill related value with 1st DropDown, Therefore it must be fill when 1st DropDown oncahange.
    I gave error message at the bottom.
    How can i solve this problem?
    Thanks.
    Note: No problem about build and run.Only runtime  error .
    Below is code that fills 2nd DropDownListByKey
    IWDAttributeInfo attInf = wdContext.getNodeInfo().getAttribute(wdContext.currentContextElement().ELEMENT);     
    ISimpleTypeModifiable stm = attInf.getModifiableSimpleType();
    IModifiableSimpleValueSet svs = stm.getSVServices().getModifiableSimpleValueSet();
              try {
                   InitialContext ctx = new InitialContext();
                   DataSource ds = (DataSource) ctx.lookup("jdbc/SAPXXXDB");
                   Connection con = ds.getConnection();
                   Statement stmt = con.createStatement();
                   ResultSet rs = stmt.executeQuery("select FIELD2 from ZTABLE Where FIELD1 = 1stDropDownValue");
                   svs.put("", "");
                   while (rs.next()) {
                        svs.put(rs.getString("ELEMENT"), rs.getString("ELEMENT"));
                   con.close();
              } catch (Exception e) {
                   wdContext.currentContextElement().setMESSAGE(e.toString());
    Error
    com.sap.tc.webdynpro.progmodel.context.ContextException: MappedAttributeInfo(YYYYappView.ELEMENT): must not modify the datatype of a mapped attribute

    Hi Cemil Bozlagan,
    There is no problem in your coding. That's why you are not getting  build error. Actually  
    getModifiableSimpleType();
      must not be used to mapped context attribute. Because it throws run time exception
    You may have mapped this attribute wdContext.currentContextElement().ELEMENT with some other attribute in controller.
    Now you have two options.
    1.If you don't use this dropdown values outside the view, remove the context mapping and try with this  code.
    2.If you are using these values in some other places(other views or controllers) then create a method  in the controller(custom/ component) where you have base attribute as Mr.Satyajit told. Copy this code into the method.
    In 1st dropdown onSelect event handler just call that method of the controller.
    I hope I made it clear it to you. Feel free to revert in case of any issues.
    Regards,
    Siva

  • Dropdown list in WD-ABAP.

    hi gurus,
                I'm doing WD for ABAP and I'm trying to get contents into a dropdown list. I'm using DropDownListByKey. The contents come from a customizing table. I'm not sure where exactly I should add my coding: does it go into a supply function for my context attribute? Or in the method WDDOINIT? Basically, if you could point me towards some sample code, it would very user
    Thanks in Advance,
    Regards,
    Ravi.

    Hi,
         As per your suggestion,i implemented the following code in the doinit Method,
    but there is no value is populated in my dropdownlist box.
    I check the code by debugging, <b><i>i am not getting  any value in the following area
    ( ls_valueset-value = wa_kna1-kunnr.
       ls_valueset-text = wa_kna1-kunnr. )</i>   </b>
        kindly check the following code. 
           data: lt_valueset  type standard table of wdr_context_attr_value,
                   ls_valueset  type wdr_context_attr_value,
                 lr_node_info type ref to if_wd_context_node_info,
                 lr_node type ref to if_wd_context_node,
                 wa_kna1 type kna1,
                 lt_kna1 like table of wa_kna1.
          lr_node = wd_context->get_child_node( 'NODE_KNA1MOD' ).
          lr_node_info = lr_node->get_node_info( ).
          loop at lt_kna1 into wa_kna1.
             ls_valueset-value = wa_kna1-kunnr. "this will be the selected value
             ls_valueset-text = wa_kna1-kunnr.   "this will be the displayed value in the UI
              append ls_valueset to lt_valueset.
          endloop.
        lr_node_info->set_attribute_value_set(
                                exporting
                                  name       = 'KUNNR'
                                  value_set  = lt_valueset ).
    In the LAYOUT: i binded the selected key properties as kunnr.
       properties
             selectedkey = kunnr.
            kindly give me some suggestion,to come out of this problem.
    Thanks in advance,
    Regards,
    Ravi.

  • Populate data in dropdown

    Hi All,
    I am trying to populate values in dropdown by calling
    BAPI. I have only one view in my applicaiton.
    I created a model in custom controller and bind it to   the model.
    I defined the context (model node) in view controller same stucuture in custom controller and mapped the context between view controller and custom controller.
    Model node
    Zemployee2_Input
       Output
         TEmployee
           Empname
           Empno
    Value attribute
        empCode
    I created a Template( table) and bind with the view context.
    When I deployed the application, the table was displaying 32 records.
    I have a problem to populate values in the dropdown.
    I created value attribute called empCode in View contr.
    I bind the attribute to the value property of dropdown
    called dropdownEmployee.
    issue#1:
    int nodeSize =  wdContext.nodeZemployee2_Input().size();
    In runtime
    nodeSize has 1.
    But it supposed to have 32.
    issue#2:
    ((IPublic<controller_name>.I<node_name>Element)(wdContext.node<node_name>().getElementAt(i))).get<attribute_name>());
    What is get<attribute_name> ?
    As per my model nodes,
    I wrote this code like,
    ((IPublicTestCustom.IZemployee2_InputElement)(wdContext.nodeOutput().getElementAt(i))).?
    after this,
    Intellisense gives me 3 options to select,
    getAttributeAsText();
    getAttributeValue();
    getClass();
    Where do i select get<attribute_name> ?
    Please give me a solution for this.
    Thanks

    Hi,
    int nodeSize = wdContext.nodeZemployee2_Input().size();
      As Table showing 32 records, dropdownlistbox also show the same records. Have bind the table to same node or different one?
      I have pasted code to you, which is working fine with me. try to make use of it.
    Create a context Variable in your View with empcode.
    empCode - whichever you want to see in the DropDownListByKey.
    IContextElement contextElement = wdContext.currentContextElement();
    IWDNodeInfo nodeInfo = wdContext.getNodeInfo();
    IWDAttributeInfo dateAttributeInfo = nodeInfo.getAttribute(contextElement.empCode);
    IModifiableSimpleValueSet dropValueSet = dateAttributeInfo.getModifiableSimpleType().getSVServices().getModifiableSimpleValueSet();
    String empCodeTxt=null;
    //Gives the Size of the List, which is coming from Model
    int nodeLength = wdContext.node<BAPIList>().size();
    for (int i = 0; i < nodeLength; i++) {
    // Gives the Value, Which you want to show in Drop Down List Box.. Change it according to your need.
    empCodeTxt=String.valueOf(((IPrivate<viewname>.I<BAPIList>Element)(wdContext.node<BAPIList>().getElementAt(i))).get<Parameter>());
    dropValueSet.put(empCodeTxt, empCodeTxt);
    Regards,
    Sridhar

  • DropDownList and setLeadSelection

    Hi everyone,
    I create da dropdownlistbykey and its value is bound to a simple type I created in the dictionary.
    I am not able to set the leading selection to position 1 which is the frst value defined in the disctionary.
    Here is the details of the node :
    node DataSource
    value attribute A
    value attribute B
    value attribute Currency which is bound the the simple type
    I want to display the first value defined in the simple type in Currency.
    Should I create another node under DataSource especialy for Currency ?
    Thanks for the help.
    Regards.

    Hi,
      Say your enumerated simple type is like this:
    Value|Description
    1    |Value1   
    2    |Value2
    3    |Value3
    Now if you say setSelectedKey("2"), the entry Value2 in your dropdown will be selected. Whatever you are entering as a parameter to setSelectedKey(), should be a key in the enumeration.
    <i>But what happened if you defined a Node and a value attribute in it.</i>
    What about this? I didn't understand. All you should be doing in this case is bind the selectedKey property to Node.nodeAttribute. Here is nodeAttribute is of type simpletype. Make sure the cardinality of the node is 1...1.
    Regards,
    Satyajit.

  • Web Dynpro ABAP: How do I fill dropdown lists?

    Hi,
    I'm doing WD for ABAP and I'm trying to get contents into a dropdown list. I'm using DropDownListByKey. The contents come from a customizing table. I'm not sure where exactly I should add my coding: does it go into a supply function for my context attribute? Or in the method WDDOINIT? Basically, if you could point me towards some sample code, it would make me very happy!
    Thanks, Ira

    Hi,
    see http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4884180951809e10000000a155106/frameset.htm and the examples in the system in WDR_TEST_EVENTS and WDR_TEST_UI_ELEMENTS.
    Regards, Heidi

  • New to webdynpro abap

    Hello,
    I am quite new webdynpro abap. I would like to display a dropdown box, input field on an iView. The selected value from dropdownbox and entered input value together has to be displayed during runtime. I was looking around for a step by step by guide which i couldn't find. Please provide me a solution for which points are rewarded
    best regards,
    k.c.

    Hi,
    There are 2 dropdown UI elements present in WD abap.
    1. For DropDownListByKey:
    Create a dropdownby key element in your view, and bind the selectedKey property to whichever node attribute you wish to bind. When you select a value in the dropdown, it is this value you have to bind and init method write code to popuate the values to the dropdown.
    The wddoinit method: write the following code:
    data: lt_valueset type standard table of wdr_context_attr_value,
    ls_valueset type wdr_context_attr_value,
    lr_node_info type ref to if_wd_context_node_info,
    lr_node type ref to if_wd_context_node,
    wa_kna1 type <your kna1 table type>.
    lr_node = wd_context->get_chilod_node( 'NODE_KNA1MOD' ).
    lr_node_info = lr_node->get_node_info( ).
    loop at kna1 into wa_kna1.
    ls_valueset-value = wa_kna1-kunnr. "this will be the selected value
    ls_valueset-text = wa_kna1-kunnr. "this will be the displayed value in the UI
    append ls_valueset to lt_valueset.
    endloop.
    lr_node_info->set_attribute_value_set(
    exporting
    name = 'KUNNR'
    value_set = lt_valueset ).
    you can find more info at:<a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4884180951809e10000000a155106/frameset.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/c5/e4884180951809e10000000a155106/frameset.htm</a>
    2. Dropdown by Index:
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/dd/b0884118aa1709e10000000a155106/content.htm">http://help.sap.com/saphelp_nw2004s/helpdata/en/dd/b0884118aa1709e10000000a155106/content.htm</a>
    Define a node (for eq. 'TEXT') with cardinality '0..n' with attribute (for eq. 'TEXT').
    In the view create a UI element DropDownIndx
    Bind the text property of DropDownbyIndex UI element to attribute Text of context node Text.
    For populating the values to the node text;
    In the WDDOINIT method you can prepare an internal table with the values and bind it to the node and the lead selection defines the selected element.
    The below code sample may help.
    method WDDOINIT .
    for populating the values in drop down
    data:
    node_text type ref to if_wd_context_node,
    stru_text type if_componentcontroller=>element_text,
    tab_text type if_componentcontroller=>elements_text .
    node_text = wd_context->get_child_node( name = if_componentcontroller=>wdctx_text ).
    Set/fill your values
    stru_text-text = 'Value1'.
    append stru_text to tab_text.
    stru_text-text = 'Value2'.
    append stru_text to tab_text.
    set values to the node
    call method node_ddi_also_text->bind_table
    exporting
    new_items = tab_text.
    endmethod.
    for reading the values which user has selected in dropdown; for reading the selected index you can write the logic/method for the Onselect event of dropdownbyindex ui element. in the method read the attribute of the node text. the lead selection of the node gives the selected element (you can use the code wizard to read the context).
    Hope this helps.
    Regards,
    Suresh

Maybe you are looking for

  • Window 8.1 update & invalid security certificate errors

    I set up my new PC 2 days ago running Windows 8.1. I was able to visit all websites, including secure ones, w/no issues via Firefox. Last night, suddenly I was unable to access many secure websites. These include Google (Gmail) & Ilines (email). Here

  • One Line Item for More than one Ship to Party

    Dear Friends In one sales order which has only one Line Items for example P-101 qty-40 pcs. That 40pcs should shipt to my 4 ship-to-party. How I end user to do it. in one Line item in One Sales Order. Kindly Regards Arun

  • Illustrator creating greyscale PDF

    I was trying to convert an illustrator CS2 file into a PDF and it keeps coming out in greyscale. Not sure if there is a setting that I'm missing or what, but any help on this would be appreciated. Thanks! j o s e f www.beendeleted.com

  • "put dependent files" file name in dialog

    <good> When I'm doing a Save All, and I get the dialog asking to put dependent files... this dialog pops up for each of the files to be saved. </good> But,  I don't see anywhere on it the name of which file I'm trying to put in this instance.  (It di

  • Creating tablespace error

    Hi all I am trying to create a tablespace, but i am getting the following error. ORA-00604: error occurred at recursive SQL level 1 ORA-06553: PLS-213: package STANDARD not accessible This is my command create tablespace dummy_ts logging datafile '/h