Search Help Exit to Filter Blocked Vendors
I have been asked to modify the standard vendor search helps to filter out blocked vendors using a search help exit. This sounds pretty simple at first glance (and maybe it is), but I haven't been able to figure it out how to do it.
I have made a copy of F4IF_SHLP_EXIT_EXAMPLE and assigned it to elementary search help KREDA.
The selection method is M_KREDA; however this view and the others for vendors do not include the u2018blocked vendoru2019 indicator (SPERR). So I am not sure how to use the SHLP-SELOPT internal table.
It actually seems a lot simpler simply to go to the individual views and add the condition to the selection conditions.
Does anyone have any thoughts on this?
Brad Bohn replied
You are right - it's not easily done. However, it CAN be done via exits, both a collective search help exit and an elementary search help exit. As you pointed-out, you can't use a select-option in this case. In most, if not all, cases you should be calling the collective help KRED first, right?
Add an exit function to that collective help. What you need to do at the collective level is to redefine the interface of the selected elementary search helps at step 'SELONE' - this is where you can filter non-desired search helps dynamically before the user can pick one, but you can also redefine the interface of each search help listed in SHLP_TAB, i.e., change SHLP_TAB-INTDESCR-SELMEXIT to add your new elementary search help exit helper function. In this function, you are going to use step 'DISP' which is called after the view selection has been made. RECORD_TAB is going to have your selected records. You need to use the F4 helper funtion to map RECORD_TAB to an internal table to get the vendor numbers, then check for the SPERR value, then filter/delete the RECORD_TAB records out that are blocked according to your check. See F4UT_POST_SELECTION_EXAMPLE as a filtering example.
Fun stuff - next your users will be asking why your vendor search helps are so sloooowwww...