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

Similar Messages

  • How to populate values in List Box in Adobe form

    Hi,
    How to populate values in List box in adobe forms?
    Thanks
    RB

    if you want to display a fixed values in the dropdown you can use list box ui and can specify values there
    or if u want to display values from the context node of the webdynpro
    1. Drag and drop a Value Help Drop-down List element from the Web Dynpro Library tab to the Body Pages pane.
    2. Drag and drop your node from the Data View tab onto it. This action binds the layout element to the corresponding node.
    with regards
    shanto aloor

  • How to populate values for a new field in target infoprovider

    Hi Experts,
    am new to BI. i would like to know on how to populate values for a new field in the target cube with start rotuine.In my case,  i have a source infoprovider, which has 3 fields and a target infoprovider, which has 5 fields. i need to populate the new 2 fields in start routine. i dont want to populate using Field routine and am using 3.5 version. please assist with code on how to solve this issue.
    Thank you,
    Chitra.
    Edited by: Chitra_BI on Jun 13, 2011 10:23 AM

    Debug the standard code and see where the other fields are getting update. you can use the similar approach and area to code for the new field.
    Regards,
    Lalit Mohan Gupta.

  • How to populate values into a Listbox on selection screen

    Hi All,
    Please any one let me know how to populate values (for ex.01,02 and 03) in a list box of selection screen..
    Thanks,
    Vijay

    Try this code ...
    REPORT  ZLISTBOX.
    TYPE-POOLS: VRM.
    TABLES SPFLI.
    TABLES SSCRFIELDS.
    DATA flag.
    DATA: NAME TYPE VRM_ID,
    LIST TYPE VRM_VALUES,
    VALUE LIKE LINE OF LIST.
    PARAMETERS PS_PARM LIKE SPFLI-CARRID AS LISTBOX VISIBLE LENGTH 5
    USER-COMMAND fcodex.
    data: i_spfli type spfli occurs 0 with header line.
    PARAMETERS PQ_PARAM LIKE SPFLI-connid AS LISTBOX VISIBLE LENGTH 15
    USER-COMMAND
    fcodey.
    *DS AS CHECKBOX USER-COMMAND FLAG.
    INITIALIZATION.
    NAME = 'PS_PARM'.
    DATA T TYPE I VALUE 0.
    SELECT DISTINCT carrid into corresponding fields of table i_spfli FROM
    SPFLI.
    loop at i_spfli.
    VALUE-KEY = i_spfli-CARRID.
    VALUE-TEXT = i_spfli-CARRID.
    APPEND VALUE TO LIST.
    endloop.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
    ID = NAME
    VALUES = LIST.
    AT SELECTION-SCREEN.
    if sy-ucomm eq 'FCODEX'.
    REFRESH LIST.
    CLEAR LIST.
    PQ_PARAM = ' '.
    NAME = 'PQ_PARAM'.
    SELECT * FROM SPFLI WHERE CARRID = PS_PARM.
    VALUE-KEY = SPFLI-connid.
    VALUE-TEXT = SPFLI-connid.
    APPEND VALUE TO LIST.
    ENDSELECT.
    endif.
    AT SELECTION-SCREEN OUTPUT.
    LOOP AT SCREEN.
    IF SY-UCOMM NE 'FCODEX' OR SY-UCOMM NE 'FCODEY'.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
    ID = NAME
    VALUES = LIST.
    MODIFY SCREEN.
    ENDIF.
    ENDLOOP.
    START-OF-SELECTION.
    clear i_spfli.
    refresh i_spfli.
    select * into table i_spfli from spfli where carrid = ps_parm and connid
    = pq_param.
    loop at i_spfli.
    WRITE: / 'CITY FROM:', I_SPFLI-CITYFROM, 'CITY TO :',I_SPFLI-CITYTO,
    'DEPARTURE TIME :', I_SPFLI-DEPTIME.
    ENDLOOP.

  • How to Populate Values in Report for Fields

    Hi Experts,
    I have a Report requirement where in I need to Populate values for FROM Period & TO Period based on the user i/p for Quarter variable.
    For Eg;
    Fiscal year : 2009
    Quarter : 3
    Mat     Year         From period    ToPeriod          QTY
      A      2009            07                  09                1
      B      2009            07                  09                22
      C      2009            07                  09                44
    There are no fields FROM Period or TO Period in Cube.I need to populate them in the report directly.
    Please give some inputs to goahead.
    Thanks
    Ravve
    Edited by: ravve king on Jun 4, 2009 4:38 PM
    Edited by: ravve king on Jun 4, 2009 4:39 PM

    You're going to need to create a User Exit in your query. Here's a link to a helpful document on how to do that:
    [Using Customer Exit Variables in BW/BI Reports Part - 1|https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/20f119d9-922d-2c10-88af-8c016638bd90]

  • How to populate value node with values?

    Hi Experts,
    I have created a new view with a vlaue node of table type.
    How can I populate values into the value node?
    Which method will be useful?
    Is there any material for Web UI Programing?
    Please help me in this.
    Thanks,
    Adi.

    Hi Adi
    If ZVal is your value node then,
      DATA: lref_entity    TYPE REF TO cl_bsp_wd_value_node,
            lref_bo_coll   TYPE REF TO if_bol_bo_col,
            lref_data TYPE REF TO <<your ZStructure>>,
             ls_data type <<your ZStructure>>.
    ls_data-<<field1>> = 'XYZ'
    ls_data-<<field2>> = 'XYZ'
         CREATE OBJECT lref_bo_coll TYPE cl_crm_bol_bo_col.
          CREATE DATA lref_data.
          CREATE OBJECT lref_entity
            EXPORTING
              iv_data_ref = lref_data.
          lref_entity->set_properties( ls_data ).
          lref_bo_coll->add( lref_entity ).
          typed_context->ZVal->set_collection( lref_bo_coll ).
    Hope this was helpful.
    Best Regards,
    Lakshminarayana

  • How to populate values in to dropdown in table ui element

    Hi,
    according to my scenario  i have atable with five records ...andi have acolumn name DATE and  it contains 5 dropdowns with some values i.e dates from jan 1 2008-dec 31 2008.user needs to select only those values which are in dropdown. can u tell me the code to populate values in to dropdown in table UI element.
    Thanks
    Raju

    Hi,
    you can go for two drop downs like DropDown by Key or Drop Down by Index as per requirment.
    Create context Node for the table UI, in that one will be for ur drop down. Create element for the Context node and add thses to the conetxt.
    Code example for DropDownBy Key:-
    ISimpleType simpleType =               wdContext     .nodeProjEstiTable().getNodeInfo()
         .getAttribute("projphasname")               .getModifiableSimpleType();
    IModifiableSimpleValueSet svs1 =
    simpleType.getSVServices().getModifiableSimpleValueSet();
    svs1.clear();
    for (int j = 0; j < projphasname.length; j++) {
         svs1.put(projphasname[j][1], projphasname[j][1]);
    for DropDownBy Index you can work in normal way means try to create element for the respective context attribute.
    Hope this may help you...
    Deepak

  • How to populate values dynamically in dropdownbykey

    Hi All,
    My requirement is to populate the dropdown filled in with values( and key) which are coming from the ZBAPI call ie web service model.
    How do i achieve this ?
    Kindly provide me with some pseudo code.
    Reg/Venkat

    Hi Venkat,
              You can populate dropdown values from webservice using the following steps. I assume you gave idea about custom controller.
    step1:
          Create custom controller.Inside custom controller Bind input value then execute webservice.
    step2:
          Now you have value node which is returned from web service. find thr size of value node.  
    After execute web service you can find size using the following code. create value node and model node object using the code.
    Step3:
    <custom controller name>.IRole_ResultNode modelnode=wdContext.nodeRole_Result();
    <custom controller name>.IRole_OutputNode valuenode=wdContext.nodeRole_Output();
    valuenode.invalidate();
    int size=modelnode.size();
    Step4:
         After find size using loop fetch values from model node into value node.Asume in this value node contains key and value.
    for(int x=0;x<modelnode.size();x++){
    <custom controller name>.IRole_ResultElement  modelElement=modelnode.getRole_ResultElementAt(x);
    <custom controller name>.IRole_OutputElement valueElement=wdContext.createRole_OutputElement();
    valueElement.setId(modelElement.getKey());
    valueElement.setText(modelElement.getValue());
    valuenode.addElement(valueElement);
    step5:
    After that bind this value node(Role_Output) into Component controller. Then Bind value node(Role_Output) from component controller into view.
    Step6:
    Finally bind dropdown UI Element into Role_Output node's attribute(ID).
    Kind Regards,
    S.Saravanan

  • How to populate values in a Listbox parameter in selection screens

    I have a parameter(as list box) field in selection screens. And now I want to populate a list from a ztable field values.  How to do that.
    Thanks in Advance

    Hi,
    You have to use the FM VRM_SET_VALUES.
    Check this example..
    TYPE-POOLS: vrm.
    PARAMETERS: p_test TYPE char4 AS LISTBOX VISIBLE LENGTH 10.
    DATA: t_data TYPE vrm_values.
    INITIALIZATION.
    DATA: s_data TYPE vrm_value.
    <b>***Here you to have to do the select and populate the internal table
    ***t_data.</b>
    s_data-key = 'ABCD'.
    s_data-text = 'First four'.
    APPEND s_data TO t_data.
    s_data-key = 'EFGHI'.
    s_data-text = 'Second four'.
    APPEND s_data TO t_data.
    CALL FUNCTION 'VRM_SET_VALUES'
    EXPORTING
    id = 'P_TEST'
    values = t_data
    EXCEPTIONS
    id_illegal_name = 1
    OTHERS = 2.
    IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
    WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.
    ENDIF.
    START-OF-SELECTION.
    WRITE: / p_test.
    Thanks,
    Naren

  • How to populate values to the variables in standard text

    Hi friends,
    I have maintained a standard text in So10 like this invoice number&vbeln&.
    Inside a function module i want to read this text and populate the value to the variable &vbeln&.How to achive this.
    Rgds.

    Thanks Simon but i didn't understand your answer but i will tell you the problem that i want to solve with foreach or iterator
    i have a view that have employeeId and employeeName and ManagerID
    create table employeesView
            EmployeeId           Number,
            EmployeeName      varchar2(100),
            ManagerId             Number
        }i want to make a foreach or Iterator to make
    every Employees with the same manager id to be in the same <af:panelGroupLayout>
    i mean
      <af:foreach or af:Iterator >
           <af:panelGroupLayout >
                   <af:commandButton id="cb1" text="All Employees With Manager Id 1" />
           </af:panelGroupLayout >
           <af:panelGroupLayout >
                   <af:commandButton id="cb1" text="All Employees With Manager Id 2" />
           </af:panelGroupLayout >
           <af:panelGroupLayout >
                   <af:commandButton id="cb1" text="All Employees With Manager Id 3" />
           </af:panelGroupLayout >
      </af:foreach or af:Iterator >How can i do this

  • How to Populate values dynamically in Select Box.

    Hi All,
    I have few select boxes in my webdynpro application. Right now I am populating them using Harcoded values in the Dictionary. But I dont want to harcode the values in the dictionary, i want pull the values from database tables or  text files of EP KM. Just let me know which is the better way to populate the select box without hardcoding & why ?
    Thanks in Advance.
    Regards,
    Aditya Metukul

    Hi Aditya,
    Getting values from KM and database is possible
    It depends on your requirement
    ie if the dropdown should contain details of documents from KM or it should display the details in a table
    if it is oracle table see this link
    Webdynpro and Oracle
    if you want to get data from km see this tutorial
    https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/webdynpro/tutorial on using knowledge management functions in web dynpro - 26.htm
    Hope this helps you
    Regards
    Rohit
    Regards
    Rohit

  • How to  Populate Values from ECC  to SAP SRM

    Hi Freinds,
    we have  two custom fields in Purchase Requisation  ( ECC ), my requirement is to  same fields i want to create in SC Item Tab, i have included in tem Tab, but now i want to populate the values from ECC  to SRM, can any give me idea how to do this
    Thanks
    Kumar Srini

    Hi,
    You need to create two custom fields in the shopping cart corresponding to the two fields in purchase requisition.
    After that, you need to map the two fields in ECC to SAP SRM. In srm spro settings, you can find the mapping options.
    regards,
    Ranjan

  • How to populate value in parmetters

    Hi
    data: wdevent TYPE REF TO CL_WD_CUSTOM_EVENT.
    call method  onactionsearch( exporting  wdevent =  wdevent ).
    there are two fields in interface of cl_Wd_custom_Event .. . name  and  parameter

    data: wdevent TYPE REF TO CL_WD_CUSTOM_EVENT.
    call method onactionsearch( exporting wdevent = wdevent ).
    Well, I am not sure what you are trying to do here, but definitely this is not correct approach. WDEVENT object is passed implicitly to event handler of your custom event. Such events are used to communicate various controllers (including cross-component comunication if event is an component interface one).
    This simply means that if you have your event and you raise it in some method by fire_my_event method you pass only the parameters expected to this event. The handler expects then to receive this event wdevent object + all parameters you have passed along with it. If you miss these parameters in handler signature (statically unknown) you can detemine them during runtime (using wdevent object). So no explicit transfer of wdevent object should be ever done. You get this object implicitly added to handler method as an importing parameter. Whether you use it or not, depends on how you want to handle the event itself. Then you do the eveluation of its attributes parameters and name values but using corresponding method.
    I think this [link|http://help.sap.com/saphelp_nw70/helpdata/en/eb/ed6f4169e25858e10000000a1550b0/frameset.htm] is what you need to go through to understand the concept entirely.
    Regards
    Marcin

  • How to populate Value in Pop Up Via Value table

    Hi Experts,
    I have created one Zfield and assign it to a structure . Then structure is mapped to its corresponding Field group .  I have provided the value table to the Domain of the same Zfield . But at the execution the F4 pop up is appearing but the data (From the Value table) is not populating in the pop up.
    Kindly let me know the procedure to populate the data in popup via Value table....
    Though i know that for some standard fields like Country and Region, already the standard domain LAND1 is provided with the value table T005 and it works fine.
    Kindly suggest. Points will be rewarded for every helpful sugesstion.
    Thanks
    Sunil

    Hi
    In the fieldgrop structure for this field, fill in the field INPUT HELP as VALUE_TABLE and generate the layout. The values will appear in F4 now.
    Regards
    Karthik

  • 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