Dropdownbykey

Hi All,
I am new to Web Dynpro ABAP.
Can anyone provide me steps to create dropdownbykey.
Provide any pdfs regarding UI Elements in Web dynpro ABAP.
Thanks in Advance!

Hi,
     Below are the steps to create dropdownbykey.
1. Create a UI element type dropdownbykey in layout
2. create a context NODE1 and add attribute DATE type DATS(what ever can be the type) under it
3. Bind this context attribute ATTR1 to ui element
4. Write below code to WDINIT() method of view or component controller to set possible values for dropdown
data: value type WDR_CONTEXT_ATTR_VALUE,
        value_set type WDR_CONTEXT_ATTR_VALUE_LIST.
  data node_info type ref to if_wd_context_node_info.
    node_info = wd_context->get_node_info( ).
      "here replace node1 with your node
    node_info = node_info->get_child_node( wd_this->wdctx_node1 ).
    value-value = sy-datum.
    value-text = 'Heute'.
    insert value into table value_set.
    value-value = sy-datum.
    value-text = 'Morgen'.
    insert value into table value_set.
    value-value = '22222222'.
    value-text = 'Gibts nicht'.
    insert value into table value_set.
     "this method set the value set to dropdown
    node_info->set_attribute_value_set( name = 'DATE' value_set = value_set ).
Regards,
Manne

Similar Messages

  • Error when trying to create a Dynamic UI Element(DropDownByKey)

    Dear All,
    I am trying to create a Dynamic UI element(dropdownbykey) .
    I used the following code which i wrote in domodify:
    if (firstTime)
    IWDTransparentContainer thetransparent =(IWDTransparentContainer)view.getElement("AttributeDynamic_TransparentContainer");
    IWDNodeInfo node = wdContext.getNodeInfo().addChild(
      "DynamicNode",null,true,true,false,true,false,true,null,null,null);
                              IWDAttributeInfo attr1=node.addAttribute("attrib00","ddic:com.sap.dictionary.string");
    IWDAbstractDropDownByKey Sizedropdown=(IWDAbstractDropDownByKey)view.createElement(IWDAbstractDropDownByKey.class,null);
    Sizedropdown.bindSelectedKey(attr1);
    thetransparent.addChild(Sizedropdown);
    When i deployed it i got the following error:
    com.sap.tc.webdynpro.services.exceptions.CreationFailedException: Cannot create view element implementation com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractDropDownByKey
    Can anyone please help me in this regard.
    Thanks and Regards
    Nishita Salver

    Dear All,
    Thanks for ur quick reply below is the entire error chain:
    com.sap.tc.webdynpro.services.exceptions.CreationFailedException: Cannot create view element implementation com.sap.tc.webdynpro.clientserver.uielib.standard.api.IWDAbstractDropDownByIndex
         at com.sap.tc.webdynpro.progmodel.view.ViewElementFactory.createElement(ViewElementFactory.java:161)
         at com.sap.tc.webdynpro.progmodel.view.View.createElement(View.java:177)
         at com.sap.satyam.dynamic_attrapp.Dynamic_attrAppView.wdDoModifyView(Dynamic_attrAppView.java:184)
         at com.sap.satyam.dynamic_attrapp.wdp.InternalDynamic_attrAppView.wdDoModifyView(InternalDynamic_attrAppView.java:364)
         at com.sap.tc.webdynpro.progmodel.generation.DelegatingView.doModifyView(DelegatingView.java:78)
         at com.sap.tc.webdynpro.progmodel.view.View.modifyView(View.java:337)
         at com.sap.tc.webdynpro.clientserver.cal.ClientComponent.doModifyView(ClientComponent.java:481)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.doModifyView(WindowPhaseModel.java:551)
         at com.sap.tc.webdynpro.clientserver.window.WindowPhaseModel.processRequest(WindowPhaseModel.java:148)
         at com.sap.tc.webdynpro.clientserver.window.WebDynproWindow.processRequest(WebDynproWindow.java:335)
         at com.sap.tc.webdynpro.clientserver.cal.AbstractClient.executeTasks(AbstractClient.java:143)
         at com.sap.tc.webdynpro.clientserver.session.ApplicationSession.doProcessing(ApplicationSession.java:321)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessingStandalone(ClientSession.java:713)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doApplicationProcessing(ClientSession.java:666)
         at com.sap.tc.webdynpro.clientserver.session.ClientSession.doProcessing(ClientSession.java:250)
         at com.sap.tc.webdynpro.clientserver.session.RequestManager.doProcessing(RequestManager.java:149)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doContent(DispatcherServlet.java:62)
         at com.sap.tc.webdynpro.serverimpl.defaultimpl.DispatcherServlet.doGet(DispatcherServlet.java:46)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.runServlet(HttpHandlerImpl.java:401)
         at com.sap.engine.services.servlets_jsp.server.HttpHandlerImpl.handleRequest(HttpHandlerImpl.java:266)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:386)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.startServlet(RequestAnalizer.java:364)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.invokeWebContainer(RequestAnalizer.java:1039)
         at com.sap.engine.services.httpserver.server.RequestAnalizer.handle(RequestAnalizer.java:265)
         at com.sap.engine.services.httpserver.server.Client.handle(Client.java:95)
         at com.sap.engine.services.httpserver.server.Processor.request(Processor.java:175)
         at com.sap.engine.core.service630.context.cluster.session.ApplicationSessionMessageListener.process(ApplicationSessionMessageListener.java:33)
         at com.sap.engine.core.cluster.impl6.session.MessageRunner.run(MessageRunner.java:41)
         at com.sap.engine.core.thread.impl3.ActionObject.run(ActionObject.java:37)
         at java.security.AccessController.doPrivileged(AccessController.java:207)
         at com.sap.engine.core.thread.impl3.SingleThread.execute(SingleThread.java:102)
         at com.sap.engine.core.thread.impl3.SingleThread.run(SingleThread.java:172)
    Caused by: java.lang.NoSuchMethodException
         at java.lang.Class.getConstructorImpl(Native Method)
         at java.lang.Class.getConstructor(Class.java:554)
         at com.sap.tc.webdynpro.progmodel.view.ViewElementFactory.createElement(ViewElementFactory.java:150)
         at com.sap.tc.webdynpro.progmodel.view.View.createElement(View.java:177)
         at com.sap.satyam.dynamic_attrapp.Dynamic_attrAppView.wdDoModifyView(Dynamic_attrAppView.java:184)
    Thanks and Regards,
    Nishita

  • How to populate values in dropdownbykey in webdynpro

    I have a scenario where I have to populte data in the dropdownbykey element, select and then submit .
    How do you first insert data from database into the dropdown list ?
    Kindly help me out by providing the steps.I am new to webdynpro.
    Thanks n regards

    Hi Saju,
    There are 2 types of dropdown ui elemts:
    1. For DropDownByIndex UI element we need to bind the text property to an attribute within a context node, which contains several elements (cardinality = 0..n). The number of elements defines the possible entries in the list. In the WDDOINIT method we can prepare an internal table with the values and bind it to the node and the lead selection defines the selected element.
    For example if u have defined a node 'TEXT' with cardinality '0..n' with attribute TEXT. Bind the text property of DropDownbyIndex UI element to attribute Text of context 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 .
    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.
    2. For DropDownByKey UI element bind the SelectedKey property to an attribute within a context node. Then you must provide the fixed values (table with key value combination) in a different way and store them in the node info. We can use the elements get_attribute method to get the attribute value which user has selected.
    For this we need to use the interface IF_WD_CONTEXT_NODE which has a method GET_NODE_INFO, which returns meta information on the respective node. This information is of type IF_WD_CONTEXT_NODE_INFO.
    Kindly refer the following code:
    method WDDOINIT .
    data: NODE_INFO type ref to IF_WD_CONTEXT_NODE_INFO,
    NODE type ref to IF_WD_CONTEXT_NODE.
    NODE = WD_CONTEXT->GET_CHILD_NODE( 'NODE1' ).
    NODE_INFO = NODE->GET_NODE_INFO( ).
    * To be able to store the fixed values for the attribute in the node info, two
    *additional variables are necessary:
    data: LT_VALUESET type WDR_CONTEXT_ATTR_VALUE_LIST ,
    L_VALUE type WDR_CONTEXT_ATTR_VALUE.
    *WDR_CONTEXT_ATTR_VALUE is a data type defined in the DDIC. It contains *two components KEY and VALUE, both of type STRING.
    *WDR_CONTEXT_ATTR_VALUE_LIST is a table type stored in the DDIC, whose *rows are of type WDR_CONTEXT_ATTR_VALUE.
    *The two variables created in the source text example are used to accept the value *pairs that will later be passed to the node info.
    L_VALUE-VALUE = 'V1'.
    L_VALUE-TEXT = 'yesterday'.
    INSERT L_VALUE into table LT_VALUESET.
    L_VALUE-VALUE = 'V2'.
    L_VALUE-TEXT = 'today'.
    INSERT L_VALUE into table LT_VALUESET.
    L_VALUE-VALUE = 'V3'.
    L_VALUE-TEXT = 'tomorrow'.
    INSERT L_VALUE into table LT_VALUESET.
    NODE_INFO->SET_ATTRIBUTE_VALUE_SET (
    NAME = 'ATTRIBUTE1'
    VALUE_SET = LT_VALUESET ).
    endmethod.
    Hope this helps.
    Best regards,
    Suresh
    Message was edited by:
            Suresh Honnappanavar

  • Problem with dropdownbyKey

    Hi All ,
    I am using one dropdownbykey element in my screen.
    If I deploy it blank is coming as default element in the list but i want my first element to be default element.
    Thanks in advance.

    You need to set value of context element`s attribute mapped to the key property of drop down by key before you display it (in wdDoInit for example) to the same like you have in a first line of drop down.

  • DropDownbyKey Problem with displayed values

    Hi all,
    I've got some strange behaviors with some dropDownbyKey. These DropDownbyKey are linked to enumerations.
    In our projects we use several DCs. 4 DCs have been developed separately.
    Since we refer in our master DCs to the 3 others DCs, dropdownbyKey of first DC displayed the key and not the description of the enumeration. It worked properly before.
    For the 3 others DCs there is no problem, description of the enumeration is displayed and not the key.
    This is really strange...moreover we made the following test: for a dropdown of master DC we refer to an enumeration included in one of the slave DC, this works properly. The description of the enumeration is displayed.
    May anobody helps me?
    Thanks a lot,
    Damien

    I also got this problem, one of my DC doesn't work with enumeration description.
    If you got something, please let me know.
    You can go to Regarding datatype, strange behavior
    for this problem.
    Thank you.
    William

  • Using WD messages with DropDownByKey in a table

    Hello,
    Has anyone here tried using the method
    reportContextAttributeMessage with dropdownbykey in a table?
    For some reason, the dropdownbykey field is marked as a missing field but the <b>cursor doesn't jump</b> to the field.
    Thanks.
    Ruthie.

    Hallo Ruthie,
    could you please specify the used NW '04  SP stack?
    Regards, Bertram

  • Check mandatory dropdownbykey

    In my view I have two dropdownbykey elements. After a push on the button I want to check if a value in the dropdown is selected.
    I found the following code to check "simple" inputfields:
    public void checkMandatory( java.lang.String fieldname )
        //@@begin checkMandatory()
        IWDMessageManager msgMan = wdComponentAPI.getMessageManager();
        String value = wdContext.nodeProject().currentProjectElement().getAttributeAsText(fieldname);
        IWDAttributeInfo projectAttr = wdContext.nodeProject().getNodeInfo().getAttribute(fieldname);
        if (value.length() == 0) {
             msgMan.reportContextAttributeMessage(
                  wdContext.nodeProject().currentProjectElement(),
                  projectAttr,
                  IMessageCCAdvice.MISSING_INPUT,
                  new Object[] { fieldname },
                  true);
        //@@end
    But if I run this a dump appears on
    String value = wdContext.nodeProject().currentProjectElement().getAttributeAsText(fieldname);
    It works fine for "simple" inputfields but not for the dropdown fields.
    Can anybody help me?
    Thanks in advance.
    Michael

    Hi
    Do dynamic validation this way, its generic for every string attribute, regardless of the UIElement..:
    //Method on the view
    public void checkMandatory( java.lang.String[] pathNodeNames, java.lang.String attributeName, java.lang.String placeHolder )
        //@@begin checkMandatory()
          //MessageManagerInstance
          IWDMessageManager messageManager =     wdComponentAPI.getMessageManager();
          IWDNode node = wdContext;
          Object attributeValue = null;
          IWDAttributeInfo attributeInfo = null;
          //Find the attribute within context tree
          if (pathNodeNames.length == 0)
               //Let's get the attribute value          
               attributeValue = wdContext.currentContextElement().getAttributeValue(attributeName);
          else
         for(int i=0; i< pathNodeNames.length; i++)
           //Go a level down within context tree
           node = node.getChildNode(pathNodeNames<i>, IWDNode.LEAD_SELECTION);
          //Let's get the attribute value          
          attributeValue = node.getCurrentElement().getAttributeValue(attributeName);
          //Extract attribute info
          attributeInfo = node.getNodeInfo().getAttribute(attributeName);
          //Check if the string is null or empty, and report nulls/empties to messagemanager
          if (isEmptyField(attributeValue))     
               messageManager.reportContextAttributeMessage(node.getCurrentElement(),
                   attributeInfo, IMessageCCAdvice.MISSING_INPUT, new Object[] { placeHolder }, true);
        //@@end
      //Metodo on the view
    public boolean isEmptyField( java.lang.Object attributeValue )
        //@@begin isEmptyField()
          String stringValue;
          if ((attributeValue != null))
               stringValue = attributeValue.toString();
               if (stringValue.trim().length() > 0)
                 return false;
          return true;     
        //@@end
      //Method which will manage dynamic validation to achieve business rules
       public void doValidateFields( )
          if (someCondition())  //You can validate based on conditions, in order to apply business rules sucessfully
            //Array of Strings would go empty if the attribute is located in context root
            //wdContext -->attribute
            this.checkMandatory(new String[]{} , fieldname , "placeholderValue");
          else
            //Careful here, you'll send one element inside the array of String for each subnode in context tree in which attributeName is located
            //on your case, within context root you have a node called "Project", and your attributeName inside "Project"
            //wdContext-->node "Project"--> attribute "fieldName"
            checkMandatory(new String[]{"Project"}, "fieldName", "placeholder text of your choice if needed");
            //Show error messages if thats the case
               wdComponentAPI.getMessageManager().raisePendingException();
    Just call the method doValidateFields whenever you want to apply dynamic validation.
      public void onActionRejectLoanRequest(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionRejectLoanRequest(ServerEvent)
         //Execute validations
         doValidateFields();
         //ATTENTION:  If at least one field didn't pass validation,
         //                    this Action's code will stop HERE, next lines
         //                    won't execute. Nice uh?
         //Call method of Loan Reject in CompController to execute reject actions
         wdThis.wdGetLoansAdministrationCompController().doRejectRequest();
        //@@end
    Normally, i use some generic error message, and pass the name or description of the value i'm validating, something like:
    "The value is mandatory, please select or enter a valid value".
    It could be generic too (passed as parameter) , with a few more refinement of this method.
    Regards
    Julio C. Herrera Cuevas

  • Empty row in UI Element DropDownByKey

    Hi there
    I have problems with the DropDownByKey UI Element. The one being populated with somme BAPI data works fine, but I want to implement one with the data from an enumeration of a simple type. What I am missing is the possiblity to set the selected element to the first value instead of having an empty row. Any ideas?
    Thank you for your help!
    Andreas

    hi,
    What is the built in type for the simple type.. I think it is string ? Check that..
    Did u set it as the type for a context attribute and map the context attribute to the dropdownby key UI element.
    If u have done this you can set the value as
    wdContext.currentContextelement.set<Cont attr name>("the value want to be selected");
    This value u want to select will be of the built in type of the enumeration
    regards
    Bharathwaj

  • How to display key in dropdownbykey element

    Hi,
    I am using dropdownbykey element to display the contact type,from R/3 it is key-value TEL-Telephone,
    currently from front-end i ma able to see "Telephone", wnt to display "TEL"
    Please advise.
    Thanks!
    Piyush

    Hi Piyush
    Please try below code in order to accomplish your requirement might helps
    HashMap keyValues = new HashMap();
    I<RFC OUTPUT NODE>Element element = null;               
    for(int i= 0; i< wdContext.node<RFC Output Node>().size(); i++)
             element = wdContext.node<RFC OUTPUT NODE>().get<RFC OUTPUT NODE>ElementAt(i);
             keyValues.put(element.get<FOR TEL>(),element.get<FOR TEL>() + "-" + element.get<FOR TELEPHOME>());     
    IWDAttributeInfo nodeInfo = wdContext.node<CONTEXT NODE>().getNodeInfo().getAttribute("DROPDOWN BY KEY NAME");
    ISimpleTypeModifiable simpleType = nodeInfo.getModifiableSimpleType();
    IModifiableSimpleValueSet valueSet = simpleType.getSVServices().getModifiableSimpleValueSet();
    //Clear valueset object if any existing values
    valueSet.clear();
    Iterator iterator = keyValues.keySet().iterator();     
    while(iterator.hasNext()) {
         Object keyValueNew = iterator.next();     
         valueSet.put(keyValueNew, keyValues.get(keyValueNew).toString());
    Hope it will helps
    Regards
    Arun Jaiswal

  • WebDynpro ABAP : Table with DropDownByKey does not have neat focus

    Hi Experts,
    I have a table, with one column of type dropdownbyKey, i need this so that i can display the DESCRIPTION rather than key. Issue is when i select a ROW in this table i see a special YELLOW BG COLOR on all columns except the column that has drop down by key   it is first thing enduser points out as issue ???
    Any help would attract points

    >
    ramkumarvalluru wrote:
    > Hi Eureka,
    >
    > I am new to webdynpro abap area.Please provide me step by step procedure for working on Dropdown by key,Check boxes  Radio buttons aand all UI elements.
    >
    > Please provide me.
    First of all, please don't attach new questions to existing threads. Second asking for step by step procedures on all UI elements is really outside the scope of a forum posting and asking for too much.  If you are that new to Web Dynpro ABAP, then start by reading the online documentation, the WDA WIKI section, and the WDA eLearnings.

  • Accessing DropDownByKey value in Table

    Hi everyone,
    I have a table and inside it dropdownbykey.
    I want to go with a loop on the table contents.
    with the following command:
    wdContext.nodeResearcherTable().getElementAt(i)...
    I get the selected row of the table.
    But, how do I get what the user chose?How do I get the selected key of the dropdownbykey in the table ?
    Thanks you guys.
    Ruthie.

    > Hi everyone,
    >
    > I have a table and inside it dropdownbykey.
    > I want to go with a loop on the table contents.
    > with the following command:
    > wdContext.nodeResearcherTable().getElementAt(i)...
    > I get the selected row of the table.
    > But, how do I get what the user chose?How do I get
    > the selected key of the dropdownbykey in the table ?
    >
    > Thanks you guys.
    > Ruthie.
    Hi Guys,
    I still have problems.
    Anilkumar - I can't use currentTableNodeElement() because
    I need to go over the intire table with a loop so I need
    some condition which uses the iterator of the loop -
    like - getElementAt(i)...
    Bharathwaj - I wasn't clear enough. key isn't a name of
    a field but I wanted to get the key of the dropdownbykey.
    after:
    wdContext.nodeResearcherTable().getElementAt(i)
    I can use either getAttributeValue()
    or getAttributeAsText().
    Any suggestions ???
    Thanks.
    Ruthie.

  • ASSERTION_FAILED when filling dropdownbykey with sql queries

    Hi everybody,
    I'm new to WDA, and I am coding a new interface for transaction CBIH82 in EHS.
    I am filling a dropdownbykey with a sql query, for the work area.
    On the view, the dropdownbykey is populated, but when I click on a button, or when I launch an action, I have the error "ASSERTION_FAILED".
    However, if I fill the dropdownbykey manually in the code, I got no error.
    Error in IE :
    The ASSERT condition was violated
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: IF_WDR_VIEW_ELEMENT_ADAPTER~SET_CONTENT of program /1WDA/LSTANDARD===============CP
    Method: CONV_VIEW_INTO_VE_ADAPTER_TREE of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
    Method: SET_CONTENT_BY_WINDOW of program CL_WDR_INTERNAL_WINDOW_ADAPTERCP
    Method: RENDER_WINDOWS of program CL_WDR_CLIENT_SSR=============CP
    Method: IF_WDR_RESPONSE_RENDERER~RENDER_VIEWS of program CL_WDR_CLIENT_SSR=============CP
    Method: IF_WDR_RESPONSE_RENDERER~RENDER_USER_INTERFACE_UPDATES of program CL_WDR_CLIENT_SSR=============CP
    Here is the dump :
    27926     else.                                                                           
    27927       IFUR_NW5_COMBOBOX~READONLY = wd_DROPDOWN_BY_KEY->vl_READ_ONLY.                
    27928     endif.                                                                          
    27929 *   >> UCA STANDARD|ABSTR_DROPDOWN_BY_KEY|READONLY                                  
    27930     if M_PARENT_READONLY = abap_true or                                             
    27931        mv_KEY_ATTR_INFO-is_read_only = abap_true.                                   
    27932       IFUR_NW5_COMBOBOX~READONLY = abap_true.                                       
    27933     endif.                                                                          
    27934                                                                               
    27935 *   >> property-UCA IFUR_NW5_COMBOBOX~REQUIRED                                      
    27936 *   >> UCA STANDARD|DROPDOWN_BY_KEY|REQUIRED                                        
    27937     if mv_WD_STATE = cl_wd_dropdown_by_idx=>e_state-required.                       
    27938       IFUR_NW5_COMBOBOX~REQUIRED = abap_true.                                       
    27939     else.                                                                           
    27940       IFUR_NW5_COMBOBOX~REQUIRED = abap_false.                                      
    27941     endif.                                                                          
    27942                                                                               
    27943 *   >> property-Property IFUR_NW5_COMBOBOX~USEDINSAPTABLE                           
    27944     IFUR_NW5_COMBOBOX~USEDINSAPTABLE = /1WDA/VTABLE_CELL_EDITOR~mv_INSIDE_TABLE.    
    27945                                                                               
    27946 *   >> property-UCA mv_VALUE_SET                                                    
    27947 *   >> UCA STANDARD|ABSTR_DROPDOWN_BY_KEY|VALUE_SET                                 
    27948     data value_set_item type WDR_CONTEXT_ATTR_VALUE.        "#EC NEEDED             
    27949     mv_VALUE_SET = mv_KEY_ATTR_INFO-value_set.                                      
    27950     read table mv_VALUE_SET into value_set_item                                     
    27951       with key value = mv_KEY_INTERNAL.                                             
    27952     if sy-subrc = 0.                                                                
    27953       IFUR_NW5_COMBOBOX~VALUE = cl_http_utility=>escape_html( value_set_item-text ).
    27954     else.                                                                           
    27955       " entry not found - only legal for "initial" value                            
    >>>>>       assert mv_KEY_INTERNAL co ` 0`.                       "#EC NOTEXT             
    27957       IFUR_NW5_COMBOBOX~VALUE = ''.                         "#EC NOTEXT             
    27958     endif.                   
    The error is at line 27956.                                                     
    And here is my code to fill the dropdownbykey in my wddoinit of my view :
    data:
        lieux_de_travail                    type string,
        description_lieux_travail           type string,
        table_record_number_travail         type TABLE OF string,
        table_lieux_travail_full            type TABLE OF string,
        lieux_travail_full                  type string,
        record_number_travail               type string,
        valeur_int                          type i VALUE 0,
        valeur_string                       type string.
    SELECT RECNROOT FROM CCIHT_WAH INTO TABLE table_record_number_travail.
    LOOP AT table_record_number_travail INTO record_number_travail.
      SELECT WANAM FROM CCIHT_WALD INTO description_lieux_travail WHERE RECNROOT = record_number_travail.
      ENDSELECT.
      SELECT WAID FROM CCIHT_WAH INTO lieux_de_travail WHERE RECNROOT = record_number_travail.
      ENDSELECT.
      IF NOT lieux_de_travail = 'ALOUETTE'.
        CONCATENATE lieux_de_travail description_lieux_travail INTO lieux_travail_full SEPARATED BY ' - '.
      ELSE.
        lieux_travail_full = lieux_de_travail.
      ENDIF.
    INSERT lieux_travail_full INTO TABLE table_lieux_travail_full.
    ENDLOOP.
    data:     NODE_INFO type ref to IF_WD_CONTEXT_NODE_INFO,
              NODE_INFO_ACLOC type ref to IF_WD_CONTEXT_NODE_INFO.
    NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).
    NODE_INFO_ACLOC = NODE_INFO->GET_CHILD_NODE( 'INFO_ACLOC' ).
    data:    LT_VALUESET type WDR_CONTEXT_ATTR_VALUE_LIST,
             L_VALUE type WDR_CONTEXT_ATTR_VALUE.
    valeur_int = 0.
    LOOP AT table_lieux_travail_full INTO L_VALUE-TEXT.
      ADD 1 TO valeur_int.
      MOVE valeur_int to valeur_string.
      L_VALUE-VALUE = valeur_string.
      INSERT L_VALUE into table LT_VALUESET.
    ENDLOOP.
    CLEAR valeur_int.
    NODE_INFO_ACLOC->SET_ATTRIBUTE_VALUE_SET(
         NAME = 'LIEUX'
         VALUE_SET = LT_VALUESET ).
    The values are stored in the context node "INFO_ACLOC", and cardinality 1.1/0.1, in LIEUX of type String.
    Anybody had this error before?
    Thank you!
    Brad

    Hi Thomas,
    thank you, that was it.
    I had a conversion of int to string, and the resulting string was not good.
    It looked like as a number in the debug mode, but not in the hexadecimal value.
    I did not saw it, because I'm beginning to learn abap too.
    Brad

  • OnSelect event for dropdownbykey, getting fired twice in IE8

    When you click on key of dropdown , the event "On Select"  getting fired twice in IE8.
    If I try the application using Firefox, it's ok.
    Someone resolve apply the oss note 1461842  and 1411235, but in both notes there's nothing about dropdownbykey.
    Thanks a lot, !!!

    >
    Baskaran Senthivel wrote:
    > Hi,
    >
    > If i am not wrong IE8 is not in the supported list of browsers.
    IE8 is supported.  You can always check the latest supported browsers from the PAM (Platform Availability Matrix) http://service.sap.com/pam
    IE8 does require one of the later Support Package levels, however. See the PAM for the details.
    As far as the notes you reference, they might well fix your problem.  The Unified Rendering fix notes often don't list all the specific issues they address.  They simply list the patch level of the UR.  This problem does sound like a client side/UR problem.

  • DropdownByKey inside ALV Table - Problem with Value set

    Hi,
    I have Component A which has a custom controller that uses the interface controller of the ALV Component.
    Custom controller has node ITAB.. that has certain attributes...
    I want DropdownByKey inside the ALV Table column. I am populating the corresponding attribute of ITAB node with the value set that I want the drop down to have.
    However when I execute the application..I get error
    " Key XXX not present in Value Set and is not initial"
    XXX is present in the Value Set table of the attribute.
    <b>Following is my code in the methods of CUSTOM CONTROLLER</b>
    <u>Generate Value Set</u>
    nodeinfo_context = wd_context->get_node_info( ).
    nodeinfo_ITAB= nodeinfo_context->get_child_node( wd_this->wdctx_ITAB ).
    <u> Populate the Value Set</u>
    data ls_valueset type wdy_key_value.
    data it_valueset type wdy_key_value_table.
    ls_valueset-key = 'FRA'.
    ls_valueset-value = 'FRANCE'.
    Append ls_valueset to it_valueset.
    ls_valueset-key = 'SFO'.
    ls_valueset-value = 'SAN FRANCISCO'.
    Append ls_valueset to it_valueset.
    <u>Set the Value Set for the Attribute</u>
    call method nodeinfo_ITAB->SET_ATTRIBUTE_VALUE_SET
                  EXPORTING
                     NAME = <b>'ATTR1'</b>
                     VALUE_SET = it_valueset.
    <u>Changing ALV Column</u>
    Get the ALV Configuration Model
      ifc_alv2 = wd_this->wd_cpifc_alv2( ).
      itab_alv2_config = ifc_alv2->get_model( ).
      itab_alv2_config->IF_SALV_WD_TABLE_SETTINGS~SET_READ_ONLY( abap_false ).
    <u>Get the Column reference for ATTR1</u> 
    ref_alv2_colset = itab_alv2_config->if_salv_wd_column_settings~get_column( <b>'ATTR1'</b> ).
    <u>Create the DropDownByKey Object</u>
    CREATE OBJECT ref_dropdownkey
              exporting SELECTED_KEY_FIELDNAME = ref_alv2_colset->id.
      ref_dropdownkey->SET_SELECTED_KEY_FIELDNAME( <b>ref_alv2_colset->id</b> ).
      ref_alv2_colset->SET_CELL_EDITOR( <b>ref_dropdownkey</b> ).
    <u>Check the value set</u>
      ref_attr_info = nodeinfo_flight_details2->get_attribute( ref_alv2_colset->id ).
    I do get back the value set if I see ref_attr_info->value_set.
    SO the Value Set is getting set for attribute ATTR1, but still I get Error
    <b>"The value selectedKey = "SFO" in DropDownByKey "_8C" does not exist in the value list and is not initial either "</b><u></u>
    SAP  User

    You have forgotten to set a cell variant. I had the same with setting a ProgressIndicator cell-editor to a table column as default editor. This causes the column to be hidden on the table while it did show up in the settings dialog. I removed the set_editor( lr_progressindicator) and created a cell variant instead with this lr_progressindicator. You then need to add this cell variant to your column. By default it will select the standard viewtext-cell-editor (which can only be textview and inputfield, like when you create a table yourself in a view), but if you use a cell variant, it will display the required cell editor if you set it (last line of the code).
    <b>In your case, replace lr_progressindicator by your ref_dropdownkey.</b>
      DATA: lr_column_settings    TYPE REF TO if_salv_wd_column_settings,
            lr_column             TYPE REF TO cl_salv_wd_column,
            lr_column_header      TYPE REF TO cl_salv_wd_column_header,
            lr_cellvar            TYPE REF TO cl_salv_wd_cv_standard,
            l_cellvar             TYPE string,
            lr_progress_indicator TYPE REF TO cl_salv_wd_uie_progr_indicator.
      lr_column_settings ?= wd_this->mr_table.
      lr_column = lr_column_settings->get_column( 'STATUSBAR' ).
      lr_column_header = lr_column->get_header( ).
      lr_column_header->set_text( 'Completed' ).
    CREATE OBJECT lr_cellvar.
      l_cellvar = 'CV_SB'.
      lr_cellvar->set_key( l_cellvar ).
      CREATE OBJECT lr_progress_indicator.
      lr_progress_indicator->set_percent_value_fieldname( 'STATUSBAR' ).
      lr_progress_indicator->set_tooltip( 'completed' ).
      lr_cellvar->set_editor( lr_progress_indicator ).
      lr_column->add_cell_variant( lr_cellvar ).
      lr_column->set_selected_cell_variant( l_cellvar ).
    I hope this will solve your issues.

  • DropdownByKey UI element is giving Classcast exception

    Hi
    In my webdynpro view if i add "DropdownbyKey" UI element and the run the application,it is giving Classcast Exception.i am getting following error
    The initial exception that caused the request to fail, was:
       java.lang.ClassCastException
        at com.sap.tc.webdynpro.progmodel.context.Paths.getAttributeInfoFor(Paths.java:202)
        at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.DropDownByKeyAdapter.setViewAndNodeElement(DropDownByKeyAdapter.java:240)
        at com.sap.tc.webdynpro.clientimpl.html.uielements.adaptmgr.URAdapterManager.getAdapterFor(URAdapterManager.java:231)
        at com.sap.tc.webdynpro.clientimpl.html.uielements.adaptmgr.URAdapterManager.getAdapterFor(URAdapterManager.java:64)
        at com.sap.tc.webdynpro.clientimpl.html.uielib.standard.uradapter.FlowLayoutAdapter$Items.getControl(FlowLayoutAdapter.java:318)
        ... 39 more
    Please help
    thanks
    Prasad

    Hi Sriram,
    You need to bind the property "selectedKey"  for the DropdownByKey UIElement
    http://help.sap.com/saphelp_nw04/helpdata/en/08/13dbfb6e779743bb2ca641ebcb3411/frameset.htm
    Regards, Anilkumar

  • Runtime error occurs when using DropdownByKey

    I run into a runtime error when I use the DropDowByKey with fixed value set: the value seletedKey = "001" in DropDownByKey "DDBK_APP_STATE" does not exist in the value list and is not initial either. But I have already added the value pair of the selectedKey using
         "NODE_INFO->SET_ATTRIBUTE_VALUE_SET(
              NAME = 'APP_STATE'
              VALUE_SET = LT_VALUESET )." and I can select it from view. But when I use the attribute bound to the dropdownbykey in select statement as where condition and bind result into table. Before the screen reflash , the error occurs.

    I have two dropdownbykeys, DROP1(bound to attribute APP_AGENT),DROP2( bound to attribute APP_STATE). Selecting the first will change the content of the other.
    The code in the onSelect event of the drop1, which will change the select list of DROP2:
      DATA:NODE_INFO TYPE REF TO IF_WD_CONTEXT_NODE_INFO.
      DATA: LT_VALUESET TYPE WDY_KEY_VALUE_TABLE,
          L_VALUE     TYPE WDY_KEY_VALUE.
      NODE_INFO = WD_CONTEXT->GET_NODE_INFO( ).
      NODE_INFO = NODE_INFO->GET_CHILD_NODE( 'NODE_SEARCH' ).
       "**************************set value set for drop down***************
        DATA lo_nd_node_search TYPE REF TO if_wd_context_node.
        DATA lo_el_node_search TYPE REF TO if_wd_context_element.
        DATA ls_node_search TYPE wd_this->element_node_search.
        DATA lv_app_agent LIKE ls_node_search-app_agent.
        DATA lv_app_state LIKE ls_node_search-app_state.
      navigate from <CONTEXT> to <NODE_SEARCH> via lead selection
        lo_nd_node_search = wd_context->get_child_node( name = wd_this->wdctx_node_search ).
      get element via lead selection
        lo_el_node_search = lo_nd_node_search->get_element(  ).
            lo_el_node_search->get_attribute(
          EXPORTING
            name =  `APP_STATE`
          IMPORTING
            value = lv_app_state ).
      get single attribute
        lo_el_node_search->get_attribute(
          EXPORTING
            name =  `APP_AGENT`
          IMPORTING
            value = lv_app_agent ).        -
    get the value of DROP1
      clear the selected value of drop down
        lo_el_node_search->set_attribute(
          EXPORTING
            name =  `APP_STATE`
            value = '' ).----
    I want to clear the selected value of DROP2
    IF lv_app_agent IS INITIAL.
      L_VALUE-VALUE = 'SUBMIT'.
        CLEAR L_VALUE-KEY .
        INSERT L_VALUE INTO TABLE LT_VALUESET.
      NODE_INFO->SET_ATTRIBUTE_VALUE_SET(
              NAME = 'APP_STATE'
              VALUE_SET = LT_VALUESET ).
      exit.
    ENDIF.
    CASE lv_app_agent .----
    there are 2 cases
      WHEN 'SUPP_APP'.
        L_VALUE-VALUE = 'APPROVE'.
        L_VALUE-KEY = '1'.
        INSERT L_VALUE INTO TABLE LT_VALUESET.
        L_VALUE-VALUE = 'INITIAL'.
        L_VALUE-KEY = '0'.
        INSERT L_VALUE INTO TABLE LT_VALUESET.
      WHEN OTHERS.
        L_VALUE-VALUE = 'APPROVE'.
        L_VALUE-KEY = '1'.
        INSERT L_VALUE INTO TABLE LT_VALUESET.
        L_VALUE-VALUE = 'INITIAL'.
        "CLEAR L_VALUE-KEY.
        L_VALUE-KEY = '000'.
        INSERT L_VALUE INTO TABLE LT_VALUESET.
        L_VALUE-VALUE = 'REJECT'.
        L_VALUE-KEY = '2'.
        INSERT L_VALUE INTO TABLE LT_VALUESET.
    ENDCASE.
    NODE_INFO->SET_ATTRIBUTE_VALUE_SET(
              NAME = 'APP_STATE'
              VALUE_SET = LT_VALUESET ).
    Then in the another method, I will fetch the value of attribute APP_STATE. I can successfully get the value and put it into where clause and get result. But I will get a runtime error then.

Maybe you are looking for

  • How to manage the "no data" loading in process chain

    Hi, I want to load some master data in delta mode with a process chain. The treatment works good except in one case. If I have no data selected during the extraction ( cause the system doesn't find any data matching with the delta field ), the proces

  • Problems when searching for non-Latin characters

    In my studies I often need to search for Japanese terms. I usually do this from the Smart Search Field to go straight to Google. However, Safari seems not to be able to handle the Japanese characters. For example, I might type 日本 into the Smart Searc

  • Adding Secondary Site SCCM2012

    I have a Primary Site Setup with general roles and  Distribution Point roles, Reporting services, Software Update point. Now we have added an another site and need to set up one more site server at site-2. I need to distribute the software updates of

  • Flash 10.3 not recognized in IE9 on W7x64

    System specs Windows 7 Pro 64bit (not SP1 yet) Intel I7, Boot drive RAID 0 SSD Norton Internet Security MalwareBytes Anti_Malware PRO (no malware found) Downloaded and installed latest nVidia GT9500 drivers Problem Details and attempted solutions Exp

  • Identify duplicated authorization objects in a role

    Hi, We built some roles manually by drag and drop transaction through the menu tab. In some roles, we have duplicated authorization object For example, in PM : Maintenance Plant (object I_SWREK), we have 2 profiles with SWERK=* and TCD = (list of tra