I want to get as much as possible of the basic functionality of my BSP application without programming. I prefer a declarative way of programming, where you use the data dictionary as much as possible. The Model-View-Controller paradigm is a step in that direction. However, the htmlb:dropdownListBox has two big problems in here: sorting the list by code (not by name) and ignoring default values in Search Helps.
For example, if you want a list box of Employee Groups:
<htmlb:dropdownListBox id = "persg" selection = "//model/pa0001.persg" helpValues = "//model/enh_ddic.persg" />
This code fragment is from a "view", which has page attribute model, which points to the model class. The model class has an attribute pa0001 of type pa0001.
In my first version I used "//model/pa0001.persg" as the value of the helpValues attribute as well, but that did not work at all. To use helpValues, you <b>must</b> define a search help at the <b>data element</b> level, or you must have a domain with list of values. So I created a new data element ZPERSG and attached search help H_T501T to it. Then I created a new structure with a dummy field PERSG of type ZPERSG, and the I added a new attribute ENH_DDIC of the structure I just created to my model class. Then I modified my helpValues attribute to point to the new dummy field with my fancy new data element. But it still didn't work!
Then I copied search help H_T501T to ZH_T501T and re-arranged the fields and Import/Export attributes so that PERSG and PTEXT were in the beginning of the parameter list. Then the drop down list listed ALL Employee Groups in EVERY language!
To list the values only in the correct language, I added Default value of SY-LANGU to my search help. When I test my search help in SAP GUI SE11, it works fine, listing Employee Groups only in the logon language. But in my BSP application, all Employee Groups in every language are still shown! I'm afraid this is a bug in SAP.
And I would like to sort the drop down list alphabetically. Now the list seems to be sorted by the code, not by the name.