A search help is an object of the ABAP Dictionary which helps to purpose some list of values for some input filed.
2. Types of search helps
There are three types of search helps
- (a) Elementary search helps
Elementary search helps implement a search path for determining the possible entries.
- (b) Collective search help
Collective search helps contain several elementary search helps. A collective search help therefore provides several alternative search paths for possible entries.
- (c) Append search helps
Append search helps can be used to enhance collective search helps delivered by SAP with customer-specific search paths without requiring a modification.
Give a new name of the search help which you want to create for the standard search help and create a new elementary search help in the reference to the standard search is called as append search help.
3. Scope of the document:
Scope of this document is to explain the use of search help exits in the search help, we can apply the search help exit on both collective and elementary search helps.
But in this knowledge view we will take an example of an elementary search help.
4. Search Help Exit:
Search Help Exit: A search help exit is a function module which is used to make search help more flexible and we can code a single search help exit in such a way so that is can be used in various search helps.
We will explain the use of search help exit by taking an example of collective search help:
(a) Creating a new elementary search help:
Run T-Code: SE11
Press Create Button.
Specify search help selection method, for example EKKO (PO Header table)
Specify the search help parameters.
Do not specify the name of the search help exit for the time being.
Now active and execute the search help, you will see all the records form the table EKKO, but now if you want to control/ Manipulate the value of the search help output list. Then you need to use search help exit.
(b) Run T-Code: SE37
Create a Function module say YSUN_F4_SHLP_EXIT as a copy of the F4IF_SHLP_EXIT_EXAMPLE
Now create the same structure in the function module as of the search help.
Now we need to code the things under the standard IF condition given by the function module i.e. IF callcontrol-step = ‘SELECT’.
Let suppose we want to see the data of only year 2003 then we can also code it as shown by using our own select statement.
There is a function module F4UT_PARAMETER_RESULTS_PUT.This is used to pass the internal table data to the output list.
Source Code for the search help exit as given below:
*” SHLP_TAB TYPE SHLP_DESCR_TAB_T
*” RECORD_TAB STRUCTURE SEAHLPRES
*” VALUE(SHLP) TYPE SHLP_DESCR_T
*” VALUE(CALLCONTROL) LIKE DDSHF4CTRL STRUCTURE DDSHF4CTRL
TYPES: BEGIN OF i_ekko,
ebeln TYPE ekko-ebeln,
bedat TYPE ekko-bedat,
END OF i_ekko.
DATA : t_ekko TYPE i_ekko OCCURS 0.
* EXIT immediately, if you do not want to handle this step
IF callcontrol-step <> ‘SELONE’ AND
callcontrol-step <> ‘SELECT’ AND
” AND SO ON
callcontrol-step <> ‘DISP’.
* STEP SELONE (Select one of the elementary searchhelps)
* 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’.
IF callcontrol-step = ‘SELONE’.
* PERFORM SELONE ………
* STEP PRESEL (Enter selection conditions)
* 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’.
* Normally only SHLP-SELOPT should be changed in this step.
IF callcontrol-step = ‘PRESEL’.
* PERFORM PRESEL ……….
* STEP SELECT (Select values)
* This step may be used to overtake the data selection completely.
* To skip the standard selection, 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 helpful in this
IF callcontrol-step = ‘SELECT’.
DATA : t_fields LIKE TABLE OF shlp_tab-fielddescr.
DATA : w_fields LIKE LINE OF shlp_tab-fielddescr.
SELECT * FROM ekko INTO CORRESPONDING FIELDS OF TABLE t_ekko
WHERE bedat LIKE ‘2003____’.
LOOP AT shlp_tab.
LOOP AT shlp_tab-fielddescr INTO w_fields.
DATA : l_fname TYPE dfies-lfieldname.
l_fname = w_fields-fieldname.
CALL FUNCTION ‘F4UT_PARAMETER_RESULTS_PUT’
parameter = w_fields-fieldname
* OFF_SOURCE = 0
* LEN_SOURCE = 0
* VALUE =
fieldname = l_fname
shlp_tab = shlp_tab
record_tab = record_tab
source_tab = t_ekko
shlp = shlp
callcontrol = callcontrol
parameter_unknown = 1
OTHERS = 2
* PERFORM STEP_SELECT TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL RC.
* IF RC = 0.
IF sy-subrc EQ 0.
callcontrol-step = ‘DISP’.
callcontrol-step = ‘EXIT’.
EXIT. “Don’t process STEP DISP additionally in this call.
* STEP DISP (Display values)
* 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
* the only record left in RECORD_TAB. The corresponding fields of
* this line are entered into the screen.
* – “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 helpful in this step.
IF callcontrol-step = ‘DISP’.
* PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL.
5. Apply Search Help Exit in the Elementary Search help:
Now put the name of the function module in the search help exit.
Now execute the search help, you will only have the purchase order of year 2003 as shown below:
I Also hereby declare that this BLOG is based on my personal experiences and / or experiences of my project members. To the best of my knowledge, this BLOG does not contain any material that infringes the copyrights of any other individual or organization including the customers of SAP.