Skip to Content
avatar image
Former Member

How to sort DropDownList by Value instead of Key

Hi Gurus,

I am just wondering is there a way to sort the drop down list by text or description instead of key.

Sorting the internal table would not help as it will return a short dump for sorting a sorted table.

So, any help in this?

I am using the following view element and coding to populate the drop down values.

The view element:-

The codes:-

DropDownByKey.png (16.0 kB)
Codes.png (30.1 kB)
Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Feb 05, 2014 at 09:08 AM

    before binding the valueset to the attribute, just write the following code..


    SORT lt_value_set ASCENDING BY text.

    Add comment
    10|10000 characters needed characters exceeded

  • Feb 05, 2014 at 09:21 AM

    Hi Girish,

                   As you said SORTing the SORTED TABLE would give you an error,

    BUT to make it simple why not declare the table to be STANDARD table and then use SORT BY v_value 😉

    Hope this helps!

    Happy Coding,

    Santhosh Yadav

    Add comment
    10|10000 characters needed characters exceeded