Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Filtering data on a listbox based on a selection

Former Member
0 Kudos

Dear experts,

I'm very new to abap and am struggling with a few basics just wondering if anybody can help me.

I am creating a screen with two pik lists/listboxes. One pick list is dependant on another (like a parent-child relationship or in this case category and sub category).

So what I need to do is when a Parent Category is selected I want the SubCategory to be filtered by the parent selection, is there any way of doing this??? (the two check tables the values are coming from are related by a foreign key to each other and I have tried to use a search help but I'm not sure if I am implementing it correctly as its not working on the screen itself although on a selection screen it works okay).

Some other info that might help is that the screen is populated by a structure which has FK's to the two pik lists (not sure if that will be helpful). I though that the screen may just work like the selection screen but it doesn't.

Thanks in advance.

8 REPLIES 8

Former Member
0 Kudos

Have a look at the example I posted for:

(apologies for the indentation in the sample code - it was laid out using neatly with the old message editor)... it changes the options in the second listbox based on the selection in the first listbox.

Jonathan

0 Kudos

Thank you for that,

I'm a real beginner so don't yet fully understand all the ins and out of abap. Can you tell me what your doing as it looks like your working on a selection screen, I need to do this on a dynpro screen will it work as the search help didn't.

0 Kudos

No worries... I generally code examples as reports because it's quicker and easier but please keep in mind that when you compile a report program it actually creates a dynpro for you automagically (screen 1000 typically) so almost everything you can do in a report screen you can do in your own dynpros.

So in your own dynpro, you would code two fields (as per the sample) and define each as having a listbox... for each field define a function code that is triggered when you change the screen value (as in the report example). You can prefill the listboxes during the PBO logic for the dynpro, and in the PAI you can pick up which user command has been selected and allow the flow logic to go back round to the PBO and change the second listbox list depending on the value chosen in the first field.

Jonathan

Former Member
0 Kudos

Thank you very much for your, your assistance and this example

DEMO_DYNPRO_F4_HELP_MODULE

allowed me to solve the problem...

0 Kudos

Glad to hear it's solved... can you close this thread now then?

ta

Jonathan

0 Kudos

I thought I had..What do I need to do?

Former Member
0 Kudos

Thanks for the help..

0 Kudos

splendid!... you must have been closing it as I typed!

Jonathan