Skip to Content

BSP/HowTo: Filter using DropDown in Tableview

2005-12-14 – Important Update:
There has been a change in how the submitted filter values get handled between SP47 and SP54 (on WebAS 6.20), that’s why there is a problem like Marcus mentioned in his comment. I posted one quick way to find a solution in the BSP forum: TableView Filter DropDown
Watch this thread for further updates on this topic.

This one lay around unfinished for quite a while now, but as I got asked a question lately where I would have liked to pointed to my weblog, it was about time to get it done.

Before we start with the main example, pay attention to these weblogs, they give you the basics for MVC structure and tableview iterators, which I’m gonna use here. I only want to focus on the filter part, so please consult these references for additional info:

BSP – a Developer’s Journal: Part XI – Table View Iterators

BSP Programming: HTMLB TableView Iterator

BSP / HowTo: Exploring BSP Development with MVC</p>

Start with a tableview with filter …


… and then add a DropDown in the Filter Row

-selection  = ‘‘.<br /> append filter lines:-name  = ‘‘.<br />  <wa>-value = ‘‘.


That’s it, dropdown implemented – and hopefully working as well 🙂

Try it with some tables of your own, with less different values (that occur multiple times), play around a bit.

Use DropDown for iterator-manipulated column

For the second part of this weblog – maybe the language ISO code is not what you want in your tableview. And because you read some other weblogs (I hope you did) you use a tableview iterator to change the displayed text for your column. Replacing the code with the corresponding text from table T002T makes your data much more user-friendly.

METHOD if_htmlb_tableview_iterator~render_cell_start .

DATA: textview TYPE REF TO cl_htmlb_textview,
lv_language type string.

CASE p_column_key.

* –


select sptxt from t002t
into lv_language
where spras = ‘E’
and sprsl = row_data_ref->spras.

textview = cl_htmlb_textview=>factory(
id = p_cell_id
text = lv_language ).
p_replacement_bee = textview.

* –



But you also have to alter the part for your filter dropdown generation, otherwise you will still have the code values in the dropdown – which is not what you want.



Remember that (automatic) tableview functions like sort and filter can only work with data that is present in the table. If you are using an iterator to change the displayed content, you might run into problems, as your filter is not working as it is supposed to anymore.

By providing a filter dropdown you not only offer a more convenient way to use the filter, but you can also take care of any iterator-made display changes – this way the user will not get tempted to enter filter values that actually won’t work.

You must be Logged on to comment or reply to a post.
  • Good Job! Well done Max, I think you managed to present what seems to be a complicated problem in a nice and easy way.

    Now I have a easy weblog to point people to as well 🙂


    • Thanks for this posting!
      I just came across this behaviour in the process of checking my applications when upgrading from SP 47 to SP 54. And your comment here reminded me of this weblog.

      I don't know how soon I will be able to adjust the solution from this weblog (haven't had time to find the cause for the problem), but in the meantime please post your problem in the BSP forum, and mention you are using the code from this weblog. If someone else has already dealt with that, hopefully we will get a quick answer, otherwise I will use the forum thread to announce anything I find out about it.