Professional Documents
Culture Documents
Sap Search Help
Sap Search Help
Sap Search Help
Or
The Possibilities of Possible Values
by
Allan Davidson
Overview
Internal table T_CECAT has already been filled with a list of legend codes and descriptions. See program ZFMANAL8, screen
parameter Legend Code
A collective search help is the object that holds a set of elementary search helps.
Using search helps: Help settings
S1 to S3 are the restrictions that are entered in this order in the corresponding dialog box for restricting values. Each entry is considered
to be a pattern with a final '*'. Restrictions for fields that could not accept input are ignored.
Example:
=b.lh.frankfurt is entered in the input field. There is a collective search help with several elementary search helps for the field. If you
press F4, the hit list is displayed immediately.
The search help with short cut B is selected invisibly for the user. The hit list is selected with the restriction 'LH*' for the first field and
'FRANKFURT*' for the second field of the dialog box for restricting values.
Note
When you select an elementary search help with the short cut, no new default search help is stored. The default search help stored for each
user and collective search help is only reset when you select an elementary search help using the selection dialog box.
Using search helps: personal help lists
2. In technical info for a field, when you see "=" for the search help, it means that
the search help for that field is used. To find the name of the search help used,
double-click the field name in the popup, which takes you to the dictionary.
Then double-click on the table field, which gives you the field details.
Creating search helps
You create search helps in the data dictionary.
Description of fields:
Selection method: name of table or view where the data is
stored.
Text table: Filled in by system, if a text table is attached to
the selection method.
Dialog type:: Determines whether the user is presented with
a selection screen before the hit list is displayed. Possible
values:
A – Dialog depends on set of values. If there are more than
100 hits, a selection screen is displayed. Otherwise, the hit
list is displayed immediately.
D - Display values immediately.
C – Dialog with value restriction. A selection screen is
always displayed.
Hot key: allows user to type a shortcut into the field to
bypass selection of elementary search help.
Search help exit: - specify the name of a function module
to be called during the search help process (more later).
Search help parameters: Specify the names of parameters to be passed in / out, or additional fields to be used as filters for data.
IMP: Check this box to indicate that the field is an input field, that is, to be passed to the search help.
EXP: Check this box to indicate that the field is an output field, that is, to be passed from the search help to the screen.
LPOS: The position of the as it appears in the hit list.
SPOS: The position of the field as it appears in the selection screen.
SDIS: Causes the field to be “display only” in the selection screen.
Data element: Sets the attributes of the search help parameter. Normally filled in by the system.
MOD: Check this box to assign a different data element than the one supplied by the system.
Default value: Specify the default value in one of 3 ways: a ‘literal’(in quotes), a parameter ID(ZRD),
or a system field (SY-UNAME).
Search Help Hierarchy
Parameter ID
About the Parameter ID - it looks like you just create a name and description (via transaction SE80, Edit Object soft button).
You define the data type via the command "SET PARAMETER ID." Later you can use this Parameter ID, 'KRD' to set a date.
w_date = sy-datum.
SET PARAMETER ID 'ZRD' FIELD w_date.
Callcontrol-step: This field is set by the system and can be changed by your code. The function
module will be called once for each step of the process, with some conditional exceptions
noted below.
1. SELONE – before selecting an elementary search help.
2. PRESEL1 – after selecting an elementary search help.
3. PRESEL – before sending the dialog box for restricting values.
4. SELECT - before selecting the values.
5. DISP - before displaying the hit list.
6. RETURN - set by your code if one hit was found during selection.
7. RETTOP – follows RETURN if called from a collective search help
8. EXIT – set by your code. Terminates the search help process
9. CREATE - if the user selects the function “Create new values".
CALLCONTROL-STEP 1
1. SELONE
Call before selecting an elementary search help. The possible elementary search helps are already in SHLP_TAB. This timepoint
can be used in a search help exit of a collective search help to restrict the selection possibilities for the elementary search helps.
Entries that are deleted from SHLP_TAB in this step are not offered in the elementary search help selection. If there is only one entry
remaining in SHLP_TAB, the dialog box for selecting elementary search helps is skipped. You may not change the next timepoint.
The timepoint is not accessed again if another elementary search help is to be selected during the dialog.
2. PRESEL1
After selecting an elementary search help. Table INTERFACE has not yet been copied to table SELOPT at this timepoint in the
definition of the search help (type SHLP_DESCR_T). This means that you can still influence the attachment of the search help to the
screen here. (Table INTERFACE contains the information about how the search help parameters are related to the screen fields).
3. PRESEL
Before sending the dialog box for restricting values. This timepoint is suitable for predefining the value restriction or for completely
suppressing or copying the dialog.
4. SELECT
Before selecting the values. If you do not want the default selection, you should copy this timepoint with a search help exit. DISP
should be set as the next timepoint.
5. DISP
Before displaying the hit list. This timepoint is suitable for restricting the values to be displayed, e.g. depending on authorizations.
CALLCONTROL-STEP 2
6. RETURN (usually as return value for the next timepoint)
The RETURN timepoint should be returned as the next step if a single hit was selected in a search help exit.
It can make sense to change the F4 flow at this timepoint if control of the process sequence of the Transaction should depend on the
selected value (typical example: setting SET/GET parameters). However, you should note that the process will then depend on
whether a value was entered manually or with an input help.
7. RETTOP
You only go to this timepoint if the input help is controlled by a collective search help. It directly follows the timepoint RETURN. The
search help exit of the collective search help, however, is called at timepoint RETTOP.
The EXIT timepoint should be returned as the next step if the user had the opportunity to terminate the dialog within the search help
exit.
9. CREATE
The CREATE timepoint is only accessed if the user selects the function "Create new values". This function is only available if field
CUSTTAB of the control string CALLCONTROL was given a value not equal to SPACE earlier on.
The name of the (customizing) table to be maintained is normally entered there. The next step returned after CREATE should be
SELECT so that the newly entered value can be selected and then displayed.
If further pushbuttons are introduced in the hit list with function module F4UT_LIST_EXIT, these timepoints are introduced. They are
accessed when the user presses the corresponding pushbutton.
Search help exits - 2
*** This function is a search help exit for Z_TRKORR - search
*** help for transport request number. It's purpose is to limit the
Sample code from function *** hit list to transports released within the last 90 days, and to
*** sort the hit list in descending order.
module
Z_UT_F4_TRKORR_SH_EXIT data delete_date like sy-datum.
data w_selopt like line of shlp-selopt.
Parameters: p_mitid like zmitid-mitid. Parameters: p_mitid like zmitid-mitid matchcode object ZMIDA.
You can program your own possible values directly. Code the event AT SELECTION-SCREEN ON VALUE
REQUEST FOR <field name>, then write the code to produce the list. The system creates the possible values button
for you.
Programming in screens
Specify the search help name in the screen element list. If you specify a reference field which has a search help
attached, leave the search help field blank and the system will use the attached search help.
You can also code your own value-help. Define the screen field with a possible entries key (set in field
attributes). Then code a module for the field under PROCESS ON VALUE-REQUEST. You can use the function
modules DYNP_VALUES_READ and DYNP_VALUES_UPDATE to effect field transfer to / from the screen,
since this is not done during value request.