Query for Drop Down By key

Hi,
Explaining my problem with an example.
There is a hotel table where user enter hotel details
Like City, Dep Date, Arr Date, No of Days , rate  etc  and these in turn get saved to table say USER_HOTEL_DETAILS  . When user comes to his plan/entered details again, previously saved data is shown to him.
For making a selection for City I have to give a dropdown to user with cities list that are maintained in other table say HOTEL_DATA which has city, rate, and currency fields and city is the key of table.
Now if I use drop down by key or index for city I need to fetch city values from table HOTEL_DATA and have to populate context of city field of USER_HOTEL_DETAILS.
For dropdown my value text is going to be city .For key if I try to give serial numbers say 1, 2, 3 as key for populating dropdown, the key will get stored in database table against city name. To avoid this while saving data I have to write additional code while saving and retrieving data that take value against selected key.
To avoid this one way is to use city name as both Key and Value. What is the other alternative I can use for? Please help
  Regards,
  Madhvika

Hi ,
It is better to have citykey in HOTEL table and maintain a text table for the same.This is good approach.
Because tommorow if city needs to be displayed in other text also just adding the same in the text table would be suffice.
For city texts retrieve it from text table and bind to the node.
Regards,
Madhu

Similar Messages

  • Size of Drop down by key

    Hi,
    when i built value set for the first time for drop down by key, values( texts ) are displayed correctly, however when it is re-built based on other drop down instead of showing texts it is showing the key value in drop down, however if select drop down, text will be selected though key is displayed.
    i think it is something to do with drop down by key size adjustment, how to solve this.
    i guess we can use 'CALC_WIDTH4DDLBBYKEY' method of cl_wd_utilities, but how to use this??
    Please suggest!!
    Edited by: kranthi kumar on May 5, 2011 3:58 PM

    Hi Kranthi,
    You cant adjust drop down size manually.
    According to the values inserted in the dropdown, its size increased automatically.
    If there are no values in dropdown it will be small in size but with values its size increases.
    You can adjust WIDTH of drop down, but after filled with values it takes value size.
    While filling drop down key and value, pass same value to key and value.
    Example code :
          DATA : node_info TYPE REF TO if_wd_context_node_info,
            value TYPE wdy_key_value,
            set TYPE wdy_key_value_table,
            k2 type string value 'BOX',
            v2 type string value 'BOX',
            k3 type string value 'LOOSE',
            v3 type string value 'LOOSE'.
          value-key = k2.
          value-value = v2.
          APPEND value to set.
          value-key = k3.
          value-value = v3.
          APPEND value to set.
          node_info = wd_context->get_node_info( ).
          node_info = node_info->get_child_node( 'PACK_MAT' ).
          node_info->set_attribute_value_set( name = 'PACK_MATERIAL'
                                               value_set = set ).
    Cheers,
    Kris.

  • Drop Down BY Index Vs Drop Down By Key

    What is the difference between Drop Down By Index & Drop Down By Key.
    How Do we retrive What value is selected in a drop down
    regards
    Nilesh

    Hello Nilesh,
    //Create ISimpleTypeModifiable to fill the dropdownbox
    //XXX is your Desc field
                    IWDAttributeInfo soAttribInfo= wdContext.getNodeInfo().getAttribute("XXX");
                    ISimpleTypeModifiable soType = soAttribInfo.getModifiableSimpleType();
                    soType.setFieldLabel("XXXX");
                    IModifiableSimpleValueSet soSet= soType.getSVServices().getModifiableSimpleValueSet();
                    soSet.clear();
                    //To Get desc and key from web services you pass some information to the run the given Webservice do it here
                    wdContext.currentRequest_XXXViDocument_getDescnKeyArrayElement().setInfo(infonr);
                    wdThis.wdGetXXXController().getDescObjects();
                    int size = wdContext.nodeResult_getDescObjectsArray().size();
                    if (size != 0)
                         //Filling the desc in the dropdownbykey field
                         for (int i=0; i<wdContext.nodeResult_getDescObjectsArray().size(); i++ )
                              IPrivateXXView.IResult_getDescObjectsArrayElement soElement =
                                  wdContext.nodeResult_getDescObjectsArray().getResult_getDescObjectsArrayElementAt(i);
                               soSet.put(soElement.getkey(),
                              soElement.getDesc().trim() + " " + soElement.getkey().trim() );
    Implement this code for populating the drowdown when that works I can tell you the next step.
    Good Luck,
    Dharmi

  • On basis of drop down by key values i want to enable and disable ui elements is wda

    How to enable and disable ui elements on basis of drop down by key values as i show in screen shot i have 3 values in drop down by key on basis of those values i need to enable and disable ui elements in webdynpro abap kindly reply back

    Hi Sreedhara,
    There are many tutorials on SCN for learning Web Dynpro ABAP. If the following steps don't make sense to you, please do a search for some tutorials and read through the tutorial materials. Hopefully the tutorials will help you to become familiar with some of the basics of Web Dynpro ABAP.
    Here is how to enable or disable a UI element upon selection from a DropDownByKey.
    In your view context, create a context attribute of type wdy_boolean. For now, let's call this attribute IS_ENABLED
    In your view layout, bind the enabled property of the UI element to the context attribute IS_ENABLED.
    In your view actions, create an action-- let's call it SET_ENABLED-- and bind this action to the DropDownByKey element's onSelect event in the view layout.
    In the event handler method for the SET_ENABLED action, use the Code Wizard to read the value of the DropDownByKey selected value, then use the Code Wizard again to set the value of context attribute IS_ENABLED to either true or false.
    Now when a value is selected from the DropDownByKey, the SET_ENABLED action will be triggered and the IS_ENABLED context attribute will be set to either true or false. Since your UI element's enabled property is bound to this true or false value via the context binding, the UI element will change to enabled or disabled.
    Good luck!
    Cheers,
    Amy

  • Problem with Drop down by key

    Hi all,
          I Inserted several drop down by key in my view at design time. When I try to run the application it displays an error as
    java.lang.ClassCastException at com.sap.tc.webdynpro.progmodel.context.Paths.getAttributeInfoFor(Paths.java:202)
    My requirement is,
    I am getting a table with two fields(key,value) from R/3 I want to display these in the drop down by key box how to bind them to this drop down.

    Hi Refer the below link
    DropdownList box to display R/3 table  
    Re: DropdownList box to display R/3 table
    see this link for when to use DropDownByIndex (DDI) vs DDK (DropDownByKey) and how populate data from R/3.
    Re: webdynpro populating dropdown values programmatically
    populating dropdownbyvalue with the r/3 value?  
    Re: Regarding DropDown Box
    /message/2187817#2187817 [original link is broken]
    Re: DropdownList box to display R/3 table
    create context value attribute and bind to drop down by key
    not getting value from DropDownByKey
    Dropdown by key
    dynamic DropDownByKey
    http://help.sap.com/saphelp_nw04/helpdata/en/4a/8613e41629344194e4f40393740d51/content.htm
    For DropdownbyKey
    http://help.sap.com/saphelp_nw04/helpdata/en/08/13dbfb6e779743bb2ca641ebcb3411/content.htm
    For DropdownByIndex
    http://help.sap.com/saphelp_nw04/helpdata/en/24/25e08d4ba6c743b55f1d375637ba8d/frameset.htm
    Regards,
    Saraswathi
    Pls reward points for useful info.

  • Update on importing csv file for drop down options

    My search on this topic provided me with a suggestion for the capability to upload a csv file for drop down options.  However, the discussion was from April 2011.  Has any progress been made on this since?
    Thanks.

    This is not something we currently support but you can add or vote on feature ideas:
    http://forums.adobe.com/community/formscentral?view=idea
    If you need to add a new idea click "Create an idea" under "Actions" in the top right.
    Thanks,
    Jeff

  • Restrict the number of visible values in drop down by key?

    Hello,
    Is it possible to restrict the max. number of entries displayed in a drop down by key element? By default i get 10 entries which i would like to limit to 5. Thanks.
    Regards,
    Vasu

    Hi,
    If you have a set of default values (which come from the domain), you can restrict them to the specific values which you need to display. In the INIT method of the view in which this UI element is present, you will have to write code to delete the entries which you do not wish to show in the drop down by key element.
    Have a look at this code snippet:
      data:     node_info type ref to if_wd_context_node_info,
                elem_attr type wdr_context_attribute_info.
      node_info = wd_context->get_node_info( ).
      node_info = node_info->get_child_node( 'CHILD_NODE' ).
      data:    lt_valueset type wdr_context_attr_value_list,
            l_value type wdr_context_attr_value.
      call method node_info->get_attribute
        exporting
          name           = 'ATTR1'
        receiving
          attribute_info = elem_attr.
      lt_valueset = elem_attr-value_set.
      delete lt_valueset where value = 'VALUE1'.
      node_info->set_attribute_value_set(
                name = 'ATTR1'
                value_set = lt_valueset ).
    Hope this helps.
    Regards,
    Wenonah

  • Clear the values in Drop down by key

    hi all ,
    i m using drop down by key (Combo box) ..
    i have populated some values in that ..
    then i navigate to next view ... from that view i m again navigating back to the
    previous view .. now the values which was filled needs to be cleared ..
    i used invalidete method also even though the values are present in the list ..
    can any one help in this ...
    points will be rewarded
    Thanks and regards
    JK

    Hi,
    Do you want the currently selected value to be reset, or do you want to delete the entire list of values? If you want to only reset your current selection, node->invalidate( ) should do it. Invalidate your node in the inbound plug handler.
    Regards
    Nithya

  • Query on Drop Down .

    I am modifying SRM screens .
    I want to put a drop down field on the SRM screen and the Drop down values should be taken from a Z table .
    Can somebody guide me on how to go about it ?
    Values should be taken from Z table .
    Regards ,
    Ambar

    Hi,
    If this is a Web Dynpro screen you can do it as follows.
    Use the UI element Drop down by Key.
    Write the below code in the WDDOINIT to initialize the drop down  values.
    DATA : lo_nd_self_book_ui TYPE REF TO if_wd_context_node,
             nodeinfo_self_bk TYPE REF TO if_wd_context_node_info.
      DATA: lt_value_set  TYPE TABLE OF wdr_context_attr_value,
            ls_value      TYPE wdr_context_attr_value.
      DATA : lt_resp_rm_org TYPE /mrss/t_resp_rm_org_tab,
             ls_resp_rm_org TYPE /mrss/t_resp_rm_org.
    SELECT * FROM ztable  INTO TABLE lt_resp_rm_org
      LOOP AT lt_resp_rm_org INTO ls_resp_rm_org.
        ls_value-value = ls_resp_rm_org-resp_rm_org.
        ls_value-text  = ls_resp_rm_org-description.
        APPEND ls_value TO lt_value_set.
        CLEAR: ls_value, ls_resp_rm_org.
      ENDLOOP.
      lo_nd_self_book_ui = wd_context->get_child_node( name = wd_this->wdctx_self_book_ui ).
    nodeinfo_self_bk = lo_nd_self_book_ui->get_node_info( ).
      nodeinfo_self_bk->set_attribute_value_set( name = 'RESPONSIBLE_RM_ORG' value_set = lt_value_set ).
    Regards,
    Priya

  • Where can I get code for Drop Down Menus

    Where can I find html code for drop down menus?
    Can this be inserted as an html snippet?
    Thanks

    Cyclosaurus is the resident expert on java script. Search the forum for his posts in topics containing "drop down menu". Also Google "drop down menus" and you'll get a lot of sites with many types of menus and codes. I had trouble adding one via an HTML snippet and am still working on it just to learn the process.

  • Conditional validation for drop down list

    Hi all,
    I have been working on getting the conditional validation for drop down list to work but no luck. Here is my situation. I have a page with 'time' and 'source' drop down which contains a list of values along with null value. I have two buttons 'save' and 'close'. when a User clicks on 'Save' button, no checking should occur and the values filled in the form should be stored into the database. When a user clicks on 'Close' button, validation should occur and messages should be displayed saying 'values should be filled' . After the user fills each drop down list and hits close button, changes should be saved to the database. I used the technique posted by Jayashri and wrote the validation code in 'Close button action method'
    Here is my code
    public String btnClose_action() {
    // TODO: Replace with your code
    try {
    if (ddlTime.getSelected() == null || ddlTime.getSelected().equals("")) {
    FacesMessage message3 = new FacesMessage("Please select a value");
    message3.setSeverity(FacesMessage.SEVERITY_ERROR);
    getFacesContext().addMessage(ddlTime.getClientId(getFacesContext()), message3);
    return null;
    if (ddlSourceReq.getSelected() == null || ddlSourceReq.getSelected().equals("")) {
    FacesMessage message4 = new FacesMessage("Please select a value");
    message4.setSeverity(FacesMessage.SEVERITY_ERROR);
    getFacesContext().addMessage(ddlSourceReq.getClientId(getFacesContext()), message4);
    return null;
    sendMail("close");
    } catch (Exception ex) {
    return null;
    public String btnSave_action() {
    // TODO: Process the button click action. Return value is a navigation
    // case name where null will return to the same page.
    sendMail("save");
    return null;
    I did not set the 'required' property of both the drop downs and I dont have any message components in the page. How do I get this to work. Please help.
    Thanks,
    S

    Hi,
    Try this
    HTP.p('
    function validate_form_fields()
    var validation = true;
    if (document.forms[0].fld_1.options[document.forms[0].fld_1.selectedIndex] == null )
    validation = false;
    alert("Selection of FLD1 is mandatory.");
    if (document.forms[0].fld_2.options[document.forms[0].fld_2.selectedIndex] == null )
    validation = false;
    alert("Selection of FLD 2 is mandatory.");
    return validation;
    ');If the above does not work, it could be the definition of the your fld_1 select - options. Looks like they allow null values, and if null is not the first option then selectIndex = 0 will be a not null option by default.
    Moreover, the below has redundant condition as ==0 and &lt; 1 amount to the same thing. selectIndex cannot be negative.
    if ((document.forms[0].fld_1.selectedIndex == 0 ) || (document.forms[0].fld_1.selectedIndex < 1 ))Regards,

  • Pass Multiple Parameters to SQL query in Drop down or Select Boxes

    Post Author: JasonW
    CA Forum: Data Connectivity and SQL
    Hello all- I am using CR XI and SQL server 2000.I have written a SQL statement and used that statement as a 'command' in the Database Expert, to pull data into a report.  There are two issues I have that I need some help/advice on.-. The report needs 4 parameters.  A, B, C, D.-. I can create Parameters in the Database Expert that will prompt me for the data when I refresh the report. However,-. I need to be able to select those parameters in drop down boxes based on data in the SQL database.  The problem is that the parameter cannot pull the data without the criteria - so a drop down box seems impossible.  OR is it?  That is part of my question.  The other part is - Even if it is possible, can Crystal do this somehow?  NOTE: The query is selecting the data rather than Crystal - so Creating a Parameter field IN the report is futile. -. The other half of this problem is that users would like the ability to select multiple values from Field A and from Field B.  

    Post Author: JasonW
    CA Forum: Data Connectivity and SQL
    I ended up using a stored procedure.  This queries the proper data, and allows me to use Dynamic Parameters to make multiple selections on the data.  (I query out a large portion of the data in the stored procedure, then pair it down using Dynamic Parameters in Crystal.) Here is the new problem this has created:My Dynamic Parameters are not pulling all the values from the query.  Ex.  One field in the query is a "directory" listing.  It has 227 unique values in it.  (It has multiple values, it is not constrained.)  When I create a Dynamic Parameter off of this field, I only get 18 of the 227 as available selections in the drop down box.  However, I can type in any of the 227 values into the field manually, I pull the proper data.  So the data is there, its just not showing up in the drop down box.   Anyone have any ideas on this?

  • Is this a bug for drop down box in DS1.3?

    I found that if there were many items (e.g. 50), when I clicked the arrow of the drop down box, it showed the items and then disappeared all the items except "ALL". I have to use "F4" key to display all the items and use scroll bar to show the items.
    It is OK when there are few items and no scroll appears in the list.
    Did anybody meet with the same problem?
    Thank you.

    Roam,
    Thanks again for your suggestion,
    "Furthermore one should always Repair Permissions both before doing a Software Update and again afterwards."
    I honestly dont know anything about this "Repair Permissions" from the name, i though it is a verification of authentication to repair OS or some kind of credential issue, and since i m admin user then there is no point to verify it, i should be allowed to do so. Again it is my first time to do this thing in 3 - 4 years of using panther, every time i update software i never ever do this! If this step is essential for every update and installation why dont apple put them as one of TODO step during the processes (as licensing agreement) instead of keep them as an option (just my thought) Anyway, I m glad u tell me about it, and i will give it a shot tonight.
    "That may because you didn't have sufficient disk space. In fact running out of disk space can create all sorts of problems. Please tell me how disk space is available on your
    start up drive."
    That what I thought coz i have only 5.x GB left in 60 GB HD. Thats why I claimed as whining and have to scarify the lost of data by reinstall panther in order to get my mac back to work
    "So are you saying it is a bug or it is a hacker, I don't believe it is either"
    Please see second update info about password, and i m not impose anyone to believe, thats why the topic is a questioning sentence "Is this a bug.."
    "This Discussion site is not Applecare. The people here give their time voluntarily to those who are receptive to help."
    Thats why i ask for "mac expert" not "apple authority/technician" and always appreciate any suggestion.
    Anyway, that great to hear from you and i have learned new thing from your suggestion. I will let u know when i have tried it.

  • Auto-fill for drop down menu

    I fill a drop-down menu with 200+ part numbers. How can i implement the capability
    to type the first few numbers/letters to jump to the nearest part number
    beginning with my input?

    nathan wrote:
    > I can key focus the control and it opens when i hit the space bar. I type
    > the complete part number i can see on the list and hit enter. It picks the
    > first selection on the list. I doesn't select the one i type. Does it work
    > for anyone else?
    >
    > Ernie Howard wrote:
    > >Try: Key focus the control, hit the space bar, start typing, hit return.>>nathan
    > wrote> >> Greg McKaskle wrote> >> I fill a
    > drop-down menu with 200+ part numbers. How can i implement the>> capability>>
    > to type the first few numbers/letters to jump to the nearest>> part number>>
    > beginning with my input?>>Any ring or menubar menu should support>> type
    > ahead when it gets key f
    ocus.>The menu will of course work better if>> it
    > is sorted.>>Greg McKaskle>> I'm using Labview 5.0 with the menu ring. It
    > is not supporting type ahead.>> It gets the focus and the only helpful function
    > is the 'page down' key. Any>> ideas?
    I think the problem may be with the speed that the comparisons are made.
    If I type as fast as I can, I can get to the correct Number. If I pause for
    very long (1/2 sec ??? ) during the typing it will stall out at the last match.
    I am not sure if there are any settings for the keyboard (like typematic rate)
    that would help any. Since most part numbers (at least the ones I use) are
    in sequence this may be a real problem.
    Ex.
    323-1234-001
    323-1234-002
    It would be very difficult for me to get to the -002
    I can type 30 wpm but the words are gibberish !!
    Kevin Kent
    Attachments:
    Kevin.Kent.vcf ‏1 KB

  • Popup instead of list when using WD4A ALV Grid Drop Down By Key

    I am develop a WD4A application and I am using an ALV grid.  I have set the cell editor for one column wiht the following code:
    CREATE OBJECT lr_ddbk
        EXPORTING
          SELECTED_KEY_FIELDNAME = 'ZCURRENCY'.
      Data: lv_key_visable TYPE abap_bool,
            lv_key_visible_fieldname TYPE string.
       lr_ddbk->set_type( if_salv_wd_c_uie_drdn_by_index=>type_key_value ).
    *  lv_key_visable = lr_ddbk->GET_KEY_VISIBLE( ).
    *  lv_key_visible_fieldname = lr_ddbk->GET_KEY_VISIBLE_FIELDNAME( ).
    *  lr_ddbk->SET_KEY_VISIBLE( abap_false ).
      lr_alv_column->SET_CELL_EDITOR( lr_ddbk ).
    This code works fine.  I then fill the drop down with the following code:
    *...Build the currency drop down list
      DATA lv_default_currency TYPE wdr_context_attr_value.
      DATA lv_currency_count TYPE STRING.
      DATA ls_tcurt TYPE tcurt.
      CLEAR ls_contextvalue_set.
      CLEAR lt_contextvalue_set. REFRESH lt_contextvalue_set.
      CLEAR lv_default_currency.
      loop at it_ac_attr into ls_ac_attr.
        if ls_ac_attr-attr_id eq 'CUR'.
          select single * from tcurt into ls_tcurt
               Where spras = 'EN' AND
                     waers = ls_ac_attr-value.
          If sy-subrc = 0.
            ls_contextvalue_set-value = ls_ac_attr-value.
         ls_contextvalue_set-value = ls_ac_attr-value.
            ls_contextvalue_set-text = ls_tcurt-ktext.
            IF ls_ac_attr-DFT_FLAG = 'X'.
              lv_default_currency = ls_contextvalue_set.
            ENDIF.
            append ls_contextvalue_set to lt_contextvalue_set.
          endif.
        Endif.
      endloop.
      lo_nd_zebuy_describe_item_info = lo_nd_zebuy_describe_item->get_node_info( ).
      lo_nd_zebuy_describe_item_info->set_attribute_value_set(
                                    exporting
                                       name = 'ZCURRENCY'
                                      value_set = lt_contextvalue_set ).
    *...End build currency drop down list
    This code works fine.  The issue I am having is that the drop down is behaving like a search help field rather than a drop down list.  Meaning a popup comes when I drop down the list.  The popup has the values I have set.  I don't want a popup I want a drop down list.  Additionallly the field is editable (meaning I can type a value into the field as well as select a value).  I want the user to only be able to select values from the list.  Any help with this issue would be appreciated.

    I fugured out what I was doing wrong.  I was setting the cell editor to cl_salv_wd_uie_input_field later in the code by mistake.

Maybe you are looking for