cancel
Showing results for 
Search instead for 
Did you mean: 

How can I change Text in DropDownByKey

former_member271371
Participant
0 Kudos

Hello,

how can I change the Text in Dropdown List Box . I want programming this abap in a view method.

Thanks

Kerim

Accepted Solutions (1)

Accepted Solutions (1)

former_member190321
Participant
0 Kudos

Hi Kerim,

So you want to put values in your dropdown list ?

former_member271371
Participant
0 Kudos

Hello,

I would like "Departure Workplace" in drop down box.

Regards

Kerim

Former Member
0 Kudos

Hi Kerim,

To change or populate text in DropDownByKey in view,follow the below steps:

In Layout of the view,for Dropdownbykey UI, bind 'selectedKey' property to the View Context field.

Type of the field 'REASON' in View Context is char 20.

In your view, write the following code:

Data: lt_reason type standard table of CHAR20, (You can give whatever length you want to.)

         lv_reason type char20.

lv_reason =  'Departure from First Workplace' .

append lv_reason to lt_reason.

lv_reason =  'Departure from Home' .

append lv_reason to lt_reason.

lv_reason =  'Departure from Workplace' .

append lv_reason to lt_reason.

Now you have all the needed text in lt_reason.

By using Web dynpro code wizard,get the context node and context element and bind the internal to the DropdownbyKey UI.

Use method 'SET_ATTRIBUTE_VALUE_SET'.

lo_node_info->set_attribute_value_set( name = 'REASON' value_set = lt_reason ). "here REASON is the Context field name"

Thanks,

Faraz Khan

former_member190321
Participant
0 Kudos

Hi Kareem,

It looks to me like you already have other values populate. I suggest that you and check in the INIT method of your view, they might be populated there. Alternatively check on the on
Select event of your dropdown list. Adding the value, you should just do it as the others were done.

Answers (0)