How to implement a drop down list in ALV grid?

Drop down list is feasible to integrate into an ALV grid. It is different with a Search Help approach since we need to hit the F4 key first. But their functionality is just the same which displays a list of data where the user can select and no need for him to type.

In this tutorial, I will discuss to you how to implement a drop down list into your ALV grid. I am using the class approach and not the FM way in displaying the ALV grid.

1. In setting the fieldcatalog, set the column where the drop down list will appear. Set the parameter drdn_hndl which is included in the structure LVC_S_FCAT. So if your ALV grid will display four(4) columns and you want to display the drop down list on the second column, the value of the parameter would be drdn_hndl = 2.

2. Create a sub routine where it will fill the dropdown table. Call this subroutine before the method set_table_for_first_display.

3.Inside this subroutine, do the following steps. First, call the internal table which consists the records for display. Second, loop the internal table and pass the value of the text to another internal table, let say i_dropdown. Be sure to pass also the handle which is equivalent to the value you set in fieldcatalog. Lastly, pass the internal table to the method set_drop_down_table. (see sample codes below)

4. Once done, activate and run your program. Your output must look something like this. If you haven't produce the same, please leave a message and I will try to answer your questions.

Thanks a lot again for reading my tutorial. See you on my next post. ::) Keep on reading.

No comments:

Post a Comment

How to download the data structure of tables in SE11?

Good morning people around the world. Its me again doing some blogs. Sharing to you some tips and tricks in the SAP world. Well, before I s...