search help Exit经典样例
1、 
2、search help Exit何时被调用
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.
3、search help Exit的函数模板(F4IF_SHLP_EXIT_EXAMPLE )程序员就可以拷贝该函数进行改编,已达到适合自己企业的应用。
type-pools shlp.
type-pools f4typ. "Brücke zu alten F4-Bausteinen
tables: ddshdefsh. "Tabelle der Default-Suchhilfen
function f4if_shlp_exit_example.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" 
*" 
*" 
*" 
*" 
*" 
*"----------------------------------------------------------------------
* EXIT immediately, if you do not want to handle this step
 
 
 
 
 
 
*"----------------------------------------------------------------------
* STEP SELONE 
*"----------------------------------------------------------------------
* This step is only called for collective searchhelps. It may be used
* to reduce the amount of elementary searchhelps given in SHLP_TAB.
* The compound searchhelp is given in SHLP.
* If you do not change CALLCONTROL-STEP, the next step is the
* dialog, to select one of the elementary searchhelps.
* If you want to skip this dialog, you have to return the selected
* elementary searchhelp in SHLP and to change CALLCONTROL-STEP to
* either to 'PRESEL' or to 'SELECT'.
 
* 
 
 
*"----------------------------------------------------------------------
* STEP PRESEL 
*"----------------------------------------------------------------------
* This step allows you, to influence the selection conditions either
* before they are displayed or in order to skip the dialog completely.
* If you want to skip the dialog, you should change CALLCONTROL-STEP
* to 'SELECT'.
* Normaly only SHLP-SELOPT should be changed in this step.
 
* 
 
 
*"----------------------------------------------------------------------
* STEP SELECT 
*"----------------------------------------------------------------------
* This step may be used to overtake the data selection completely.
* To skip the standard seletion, you should return 'DISP' as following
* step in CALLCONTROL-STEP.
* Normally RECORD_TAB should be filled after this step.
* Standard function module F4UT_RESULTS_MAP may be very helpfull in this
* step.
 
* 
* 
* 
* 
* 
* 
* 
 
 
*"----------------------------------------------------------------------
* STEP DISP 
*"----------------------------------------------------------------------
* This step is called, before the selected data is displayed.
* You can e.g. modify or reduce the data in RECORD_TAB
* according to the users authority.
* If you want to get the standard display dialog afterwards, you
* should not change CALLCONTROL-STEP.
* If you want to overtake the dialog on you own, you must return
* the following values in CALLCONTROL-STEP:
* - "RETURN" if one line was selected. The selected line must be
* 
* 
* - "EXIT" if the values request should be aborted
* - "PRESEL" if you want to return to the selection dialog
* Standard function modules F4UT_PARAMETER_VALUE_GET and
* F4UT_PARAMETER_RESULTS_PUT may be very helpfull in this step.
 
* 
* 
 
 
endfunction.
4、样例代码(参考sap的实例SFLIGHT)
SFLIGHT(SE11)中设置了search help exit SAPBC_GLOBAL_F4_SFLIGHT 。代码如下:
function sapbc_global_f4_sflight.
*"----------------------------------------------------------------------
*"*"Lokale Schnittstelle:
*" 
*" 
*" 
*" 
*" 
*" 
*"----------------------------------------------------------------------
* The scope of this search help exit is decribed in the documentation.
* Note that SAPBC_GLOBAL_F4_SFLIGHT_MIN_FR provides a more complex
* example of a serch help exit.
data: begin of seatinfo occurs 0, 
 
 
 
 
if callcontrol-step = 'SELECT'.
* The search help parameters SEATSMAX and SEATSOCC are not displayed on
* the list of possible entries. Hence, provided they are not connected
* to dynpro fields, the F4 processor might consider it not to be
* necessary to select the contents of these fields.
* But this exit needs these contents in order to compute the number of
* free seats. Thus, the space for this contents is allocated by the
* following two calls. This automatically forces the F4 processor to
* fill this space with the contents of these fields.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                    
                     
                    
                 
                    
                
