A search help describes the standard input help process. In exceptions it could be necessary to deviate in some points from this standard. Such a deviation from the standard can also be implemented with a search help exit.
The input help process should look as much the same as possible throughout the entire system. Search help exits should therefore only be used for exceptions.
A search help exit is a function module that has a predefined interface. A search help exit is called at certain times by the help processor. The administrative data of the help processor are passed to the search help exit using the interface.
You can store your own program logic that manipulates this administrative data in the search help exit. Individual steps of the input help process can be skipped with a search help exit.
Search help exit F4UT_OPTIMIZE_COLWIDTH adjusts the column width in the hit list to the contents of the column. It makes sense to use this search help exit when the columns of the hit list have to be made very wide for extreme cases (e.g. for name fields), but normally they will contain much smaller values.
Each search help exit must have the same interface as function module F4IF_SHLP_EXIT_EXAMPLE (is used as pattern for all the search help exits to be created). You can find more information about the interface in the documentation for this function module.
Calling the Search Help Exit
If a search help exit is assigned to a search help, the help processor calls it at the following times:
Before Displaying the Dialog Box for Selecting the Required Search Path.
It is only called for collective search helps. Using the search help exit, the set of elementary search helps available can for example be restricted depending on the context.
Before Starting the F4 Process for the Elementary Search Help
The call is triggered independent of whether the dialog window for entering the search conditions appears or whether the selection is executed immediately (for example, because in the Hot key of the elementary search help Immediate value display is set).
Before Displaying the Dialog Box for Entering Search Conditions.
You can either influence the dialog for entering search conditions or skip it altogether here. You can also influence how the selection screen looks. The call is triggered only if there is no direct selection (that is, if in the Hot key of the elementary search help Immediate value display is not set).
Before Selecting Data.
The data selection can be partly or completely copied from the search help exit. This can become necessary if the data selection cannot be implemented with a SELECT statement for a table or a view.
Before Displaying the Hit List.
You can influence the display of the hit list in this step with the search help exit. You can reduce the number of values displayed here. For example, you can display only values for which the person calling the input help has authorization. You can also copy the complete hit list from the search help exit.
Before Returning the Values Selected by the User to the Input Template.
It could be advisable to intervene at this time if control of the further transaction flow should depend on the value selected. A typical example is setting set/get parameters.
Search help SFLIGHT is used to find flight data. When they look for flights, the staff of travel agencies normally need information about whether there are still seats available on the flight. The selection method of the search help (view on tables SCARR, SFLIGHT and SPFLI) does not directly contain this information. The selection method only contains information about the number of seats available on the flight and how many seats are already reserved.
From this information, search help exit SAPBC_GLOBAL_F4_SFLIGHT computes the number of seats still available and returns the results in a parameter of the search help. The number of seats still available can thus be displayed in the hit list.
You therefore only have to program one action in the search help exit for the call before displaying the hit list.
If the process flow of the input help, first the search help exit is called for this event, then the processing for this event is executed, and only then the next step is determined. If within the search help exit a new next step is determined, then the search help exit is not called again for this next step.