cancel
Showing results for 
Search instead for 
Did you mean: 

Setting DropDown List Value in screen

Former Member
0 Kudos
863

Hi

I have a UI table element. In this am having some 10 records.

I have a EDIT button and a drop down box in the same view.

When i select a record and click on my EDIT button, the currency corresponding to the selected record in table will be displayed in the dropdown box. For example INR in this case.

I am able to achieve this by using set attribute code as given below.

  • set currency attribute

lo_el_n_curr->set_attribute(

name = `CURR`

value = wa_itable-ztable_curr ).

Now the problem is, if i click on the drop down box, the first value in the drop down box is overwrititien by INR.

What happens is that whatever value is in the currency field for a record, it is replacing the first default value (ADP) in the drop down box. i.e. ADP is disappearing in the drop down list.

NOTE: INR is repeating twice in the dropdown list.

How to solve this problem? Or is there any other way to set the currency attribute in drop down without affecting the default first value.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

For Ex:

When you get the currency of that record into lv_curr,

Try to read the table to which the Dropdown is bound against lv_curr and get that index, lv_index.

For this dropdown now set to this index.

Regards,

Lekha.

Former Member
0 Kudos

hi,

i got your point. thanks a lot.

can u please suggest me how to get the index after i get the currency value lv_curr. I am able to get the currency value into the variable lv_curr. But how to get the index of that currency in drop down list.

Please explain in detail.

Thanks.

Former Member
0 Kudos

Hi,

For Ex:

When you get the currency of that record into lv_curr,

Try to read the table to which the Dropdown is bound against lv_curr and get that index, lv_index.

For this dropdown now set to this index.

For the dropdowns, you might have bound some table with currency list right.Ex lt_table.

read table lt_table into ls_table with key code = lv_curr.
if sy-subrc eq 0.
lv_index = sy-tabix.
endif.

Now using the set_lead_selection_index of if_wd_context_node.

Regards,

Lekha.

Edited by: Lekha on Aug 27, 2009 4:45 PM

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi,

What i understand from your post is that you are using DROPDOWNBYKEY UI element as dropdown and mapped context attribute CURR to this. For setting possible values for this drop down, you have to use method SET_ATTRIBUTE_VALUE_SET of IF_WD_CONTEXT_NODE_INFO. Write below code in LEAD SELECTION method of table.

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( ).
      
     node_info = node_info->get_child_node( wd_this->wdctx_yrnode ). "pass node name where u define context attr CURR

     value-value = 1.
     value-text = 'ADP'.  " its ur default value
      insert value into table value_set.
 
    value-value = 2.
    value-text = wa_itable-ztable_curr . "curr value for the selected row from the table        
    insert value into table value_set.

     "similarly if you want to add any more value set, add like this
    
    "now set the possible values to the drop down field 
    node_info->set_attribute_value_set( name = 'CURR'  "here CURR is ur context attr mapped to dropdown 
                                        value_set = value_set ).

After setting the value set, you can control the value to be appeared as default for each selection and use below code for the same.

* set currency attribute
lo_el_n_curr->set_attribute(
name = `CURR`
value = wa_itable-ztable_curr ). "set this value as ADP if u want ADP as default in dropdown always.

Hope this is helpful.

Cheers,

Manne.