ABAP – Dropdown List

Home / SAP / ABAP Coding / ABAP – Dropdown List

Well, yesterday I mentioned that I’m building a screen, and I wanted to have a nice dropdown list for characteristic values.  So I was able to get a table of the characteristics and values, but now I need to do something to get it into a nice dropdown list.  Here’s how I did it.  This little function module takes the field, and you give it a table (value_tab) which holds the key and the description.  Then it pulls up a nice looking popup window.

So, the first step happens in your screen designer (TXN: SE51).  In the PAI section, you need to add a statement to the bottom:

PROCESS ON VALUE-REQUEST.
field WA_CSTICS-VAL MODULE drop_cstic_val.

In this statement, WA_CSTICS-VAL is the field I needed a dropdown list for.  Then I just needed a module to load the stuff.  That was drop_cstic_val.  In that module, I just used the function I talked about yesterday in my post on dropdown list for characteristic values. Then I called this function to generate the dropdown list popup.

CALL FUNCTION ‘F4IF_INT_TABLE_VALUE_REQUEST’
EXPORTING
retfield        = ‘KEY’
window_title    = WA_CSTICS-ATNAM
dynpprog        = sy-repid
dynpnr          = ‘0100’
dynprofield     = ‘FIELD_W_DROPDOWN’
value_org       = ‘S’
TABLES
value_tab       = lt_val
EXCEPTIONS
parameter_error = 1
no_values_found = 2
OTHERS          = 3.

And that’s all there is to creating the dropdown list popup.  Thanks for reading.  I have some more tricks related to this…  but you’ll have to wait till tomorrow =)

As always, thanks for reading and don't forget to check out our SAP Service Management Products at my other company JaveLLin Solutions,
Mike

Leave a Reply

Your email address will not be published. Required fields are marked *