Search BAdI - Meta Method Explained

    Using the Meta method, you can adjust any meta data of the search. For example, you can change the search bar to dropdown or activate and disable strict search.

    Our Search BAdI blog series in overview

    1. How to Implement a Search BAdI - general overview
    2. Search BAdI - Meta Method Explained
    3. Search BAdI - Do Search Method Explained

     

    The dropdown search suites best for short result lists and always loads all values locally first. Then, the search is executed on the locally loaded values. Thus, dropdown is ideal for short lists. On the other hand, the search function is executed for the entered search term only (eventually it is executed multiple times, if you enter the letters quite slowly). Therefore, SEARCH setting suites best for objects with large master data selections.

    Filter

    The filter contains the search type and the search name. For example, if the search is executed on an InfoObject, the search name is the name of the InfoObject.

    search badi- meta method explained 1

    The table or DSO is not part of the filter. It means the BAdI is executed across all DSOs or tables, which contain the same InfoObject. This way, you don’t have to implement a BAdI multiple times for different DSOs.

    If you want to implement different searches for DSOs, which contain the same InfoObject, you can implement a new referenced InfoObject (so that the master data is reused). Moreover, you can also set table specific settings in the Table Column Properties. You can also use the Table Maintenance Meta BAdI to overwrite the settings done in the Search Meta BAdI.

    Parameters

    This exit is implemented in BADI /NLY/BADI_SEARCH, via interface /NLY/IF_BADI_SEARCH, method SET_META_EXIT. It contains the parameters shown in the table below.

    Property

    Type

    Description

    Possible Values

    I_STYPE

    CHAR 6

    Search Type (originally used)

    DDIC    Search based on table and field in Data Dictionary

    IOBJ    InfoObject

    CUSTOM    Custom

    I_SEARCHNAME

    CHAR 60

    Search Name (originally used)

    For example, name of the InfoObject, if Search Type IOBJ is used

    CH_S_SEARCH_INFO-SEARCHMODE

    CHAR 6

    Search Type (should not be adjusted)

    DDIC    Search based on table and field in Data Dictionary

    IOBJ    InfoObject

    CUSTOM    Custom

    CH_S_SEARCH_INFO-SEARCHNAME

    CHAR 60

    Search Name (should not be adjusted)

    For example, name of the InfoObject, if SEARCHMODE IOBJ is used

    CH_S_SEARCH_INFO-SEARCHSTYLE

    CHAR 30

    Search Style - dropdown or search bar

    SEARCH  - show search bar

    DROPDOWN    - show dropdown


    Remark: dropdown recommended only for less than 50 values 

    CH_S_SEARCH_INFO-MIN_CHAR

    NUMC 3

    Number of minimum characters to be entered before search will start

     

    CH_S_SEARCH_INFO-STRICT

    CHAR 1

    Strict search

    X    True

    If set to 'X' the user can only enter entries, that are coming back from the search. 

     

    Code Snippet

    You can use the following example to implement your own custom logic.

      METHOD /nly/if_search~set_meta_exit.

    ch_s_search_info-min_char = '3'.
    ch_s_search_info-searchmode = i_stype.
    ch_s_search_info-searchname = i_searchname.
    ch_s_search_info-strict = 'X'.
    ch_s_search_info-searchstyle = 'SEARCH'.

    ENDMETHOD.

    Which License is needed for this feature Professional | Enterprise


    NextTables Technical Documentation

    Do you have a question regarding NextTables?
    Already a customer? Please click here for Support.