Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

How can I change Text in DropDownByKey

Hello,

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

Thanks

Kerim

Former Member
Former Member replied

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

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question