search helps (slides)

Upload: ghenno18

Post on 03-Apr-2018

215 views

Category:

Documents


0 download

TRANSCRIPT

  • 7/29/2019 Search Helps (Slides)

    1/20

    Search Helps

    Or

    The Possibilities of Possible Values

    by

    Allan Davidson

  • 7/29/2019 Search Helps (Slides)

    2/20

    1. Different types of value help

    A. Simple list

    1. From check table / text table - used for value list that changes by application or by configuration

    2. From domain fixed value list - doesn't change except by development

    3. Programmed using an internal table and function module TR_F4_HELP (or others)

    B. Search help ( Formerly matchcode )

    1. Elementary search help - list of values

    2. Collective search help (set of elementary helps)

    2. Using search helps

    Overview

    A. Help settings (Menu path Help/Settings)

    B. Shortcuts

    C. Personal help lists - these are generated and handled by the system. They show when no

    matches are found or if you leave the field blank.

    D. Tips & Tricks

    3. Programming search helps

    A. Creating search helps with SE11

    B. Programming in reports

    C. Programming in screens

  • 7/29/2019 Search Helps (Slides)

    3/20

    Example: Table T001 is a list of company codes maintained by configuration.

    The check table is linked to the field in the dictionary by maintaining the

    foreign key relationship. (Shown here linked to BKPF-BUKRS)

    Simple list: check table

  • 7/29/2019 Search Helps (Slides)

    4/20

    Example: Field BKPF-BSTAT is linked to data element BSTAT_D,

    which is linked to domain BSTAT, which has a fixed list of values.

    Simple list: domain

  • 7/29/2019 Search Helps (Slides)

    5/20

    !"#$%&&

    !"'#$%&()!'*+#

    ,-.,

    %&/012&

    ,

    $3&&!'*#

    Simple list: programmed

    3

    $%34"

    $-%34

    $3&5&

    3

    $,3,

    ,

    34

    -3"

    3+

    -.%3'

    ,,

    3.6078(9(

  • 7/29/2019 Search Helps (Slides)

    6/20

    An elementary search help provides the list of values

    Search help: elementary

  • 7/29/2019 Search Helps (Slides)

    7/20

    A collective search help is the object that holds a set of elementary search helps.

    Search help: collective

  • 7/29/2019 Search Helps (Slides)

    8/20

    Menu path: HelpSettings

    Using search helps: Help settings

  • 7/29/2019 Search Helps (Slides)

    9/20

  • 7/29/2019 Search Helps (Slides)

    10/20

    Using search helps: personal help lists

    These are generated and handled by the system. They show

    when no matches are found or if you leave the field blank.

    Example: ABAP editor search help for program name.

    You can delete entries from this list or navigate to other search helps.

  • 7/29/2019 Search Helps (Slides)

    11/20

    Using search helps: tips & tricks

    1. Pressing F4 even when there is no down arrow sometimes gets you value help.

    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.

  • 7/29/2019 Search Helps (Slides)

    12/20

    Creating search helps

    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 witha 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 - Dis la values immediatel .

    You create search helps in the data dictionary.

    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).

  • 7/29/2019 Search Helps (Slides)

    13/20

    Search Help Hierarchy

  • 7/29/2019 Search Helps (Slides)

    14/20

    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.

    Parameter ID

  • 7/29/2019 Search Helps (Slides)

    15/20

    Search help exits - 1

    You can change the behavior of search helps with a search help exit. Copy theSAP supplied function module F4IF_SHLP_EXIT_EXAMPLE. This module is

    well documented (for a change!), but here are some highlights:

    TABLE parameters:

    SHLP_TAB - contains information about the search help fields and structures.

    RECORD_TAB contains the hit list.CHANGING parameters:

    SHLP additional information about the parameters. (Deep structure)

    CALLCONTROL instructions for controlling the search help process.

    Callcontrol-step: This field is set by the system and can be changed by your code. The functionmodule 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".

  • 7/29/2019 Search Helps (Slides)

    16/20

    CALLCONTROL-STEP 11. 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 entryremaining 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 completelysuppressing 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. DISPshould 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.

  • 7/29/2019 Search Helps (Slides)

    17/20

    CALLCONTROL-STEP 26. 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 onwhether 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. Thesearch help exit of the collective search help, however, is called at timepoint RETTOP.

    8. EXIT (only for return as next timepoint)

    The EXIT timepoint should be returned as the next step if the user had the opportunity to terminate the dialog within the search helpexit.

    9. CREATE

    The CREATE timepoint is only accessed if the user selects the function "Create new values". This function is only available if fieldCUSTTAB 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 beSELECT so that the newly entered value can be selected and then displayed.

    10. APP1, APP2, APP3

    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.

  • 7/29/2019 Search Helps (Slides)

    18/20

    Search help exits - 2

    :::%,;/'

    :::

    -.%

    -.

    :::(%!.%. >'#?

    :::%-%-

    .3&2/4&

    3.%. >'

    .3&(&

    .3&&

    & &

    Sample code from function

    module

    Z_UT_F4_TRKORR_SH_EXIT

    .

    .3

    .

    .3&/@A&

    .3&&

    .3&B&

    .3

    .

    :::

    .3&(2&

    .3&5&

  • 7/29/2019 Search Helps (Slides)

    19/20

    Programming in reportsIf there is a search help linked to a dictionary field (either directly to the field or to its data element), then defining

    a report parameter LIKE the dictionary field will bring in the search help functionality for you. You mightwant to specify the search help yourself for the following reasons:

    1. There is no search help attached to the dictionary field.

    2. You want to use a different search help than the one attached to the dictionary field.

    3. You want to specify which elementary search help to use, rather than allow the user to see the collective

    search help.

    This example forces the selection screen to adopt the elementary search help ZMIDA, rather than use the

    collective search help ZMID, which is attached to the dictionary field.

    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 , then write the code to produce the list. The system creates the possible values button

    for you.

  • 7/29/2019 Search Helps (Slides)

    20/20

    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.