A search help describes the standard input help process. In exceptional cases it may be necessary to deviate in some points from this standard. You use a search help exit to implement such a deviation from the standard.
The input help process must look as much the same as possible throughout the entire system. This is why search help exits must be used only 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 is 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 wide for extreme cases (for example for name fields), but they 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 in the following situations:
It is only called for collective search helps. Using the search help exit, the set of elementary search helps available can be restricted depending on the context, for example.
The call is triggered independently 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).
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.
The data selection can be partly or completely copied from the search help exit. This is necessary if the data selection cannot be implemented with a SELECT statement for a table or a view.
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.
It is advisable to intervene at this time if control of the further transaction flow must depend on the value selected. A typical example is setting set/get parameters.
In 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 is the next step determined. If within the search help exit a new next step is determined, the search help exit is not called again for this next step.
Search help SFLIGHT is used to find flight data. When travel agencies look for flights, they need information about seats on the flight that are still available. The selection method of the search help (view of tables SCARR, SFLIGHT and SPFLI) does not directly contain this information. The selection method contains information only about the number of seats that are 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 have to program only one action in the search help exit for the call before the hit list is displayed.
The following figure shows the functionality of the search help exit. You can see the succession of the different steps that are performed when a search help exit is used.