Overview
A search help can be used to search for values and then put them back into a field in the application:

Example of a search help for a material:

Search helps in an SAP transaction are usually displayed in a dialog. The S10 framework also offers the possibility of calling up a dialog, which in principle can be designed freely. Usually, some input fields for the search as well as the results are provided in table form. After selecting a result, the dialog is closed and the user can directly continue with the task.

Implementation
An input field gets a search help through the CSS class "valuehelp":
1
2
<input type="text" class='input valuehelp'  name="material"
       style='width: 120px;'>
 
The name of the called ABAP methdod in the active class is composed of:

"on_valuehelp_"  + name of the attribute

If the name of the attribute is "material", the method "on_valuehelp_material" is called:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
method on_valuehelp_material.

    data: selected_material type mara-matnr.

*   call value help
    selected_material = material=>valuehelp( ).

* set selected material number
    if selected_material is not initial.
      material = selected_material.
      
  endmethod.

The actual search help is then implemented in a separate class.

In this case the search help of the class "material" is called: 
1
2
3
4
5
6
7
   class-data:
      valuehelp_material type ref to material.

    class-methods:    
    valuehelp
        returning
          value(selectedmaterial) type mara-matnr.


In the implementation of the method "valuehelp" a dialog is then called, which returns the selected value after closing:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
* value help
  method valuehelp.
    if valuehelp_material is initial.
      create object valuehelp_material.
    endif.

*   call value help
    valuehelp_material->s10dialog('searchhelp').

    selectedmaterial = valuehelp_material->matnr.

  endmethod.

1
2
3
4
5
6
<div title="Choose article" 
     style="float: left; padding-left:2px; width: 28px;"

    onclick="S10Apply('searchhelp_material_select');">
    
    <img src="../../../icons/select.png" 
         style="width:18px;height:18px; cursor:pointer;">
</div>


In this case, the ABAP method "searchhelp_material_select" determines the clicked line and reads the material number:
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
 method searchhelp_material_select.

    data:
      contextinfo type ref to /s10/contextinfo,
      tablename   type string,
      rownumber   type i.

    contextinfo = s10contextinfo( ).

* clicked table name
    tablename = contextinfo->tablename.

* clicked row number
    rownumber = contextinfo->rownumber.

    field-symbols: <tab> type table.
    assign (tablename) to <tab>.

    data: m type ref to db_mara.

* read order from via index from HTML context
    read table <tab>
       index rownumber
         into m.

* set selected material
    me->matnr = m->matnr.

    s10exitdialog( ).

  endmethod.

Hint:
After the execution of "s10exitdialog( )" in line 29 the HTML dialog is closed, and the ABAP code execution is continued directly after the call of "s10dialog()" in the "valuehelp" method. This means that no new calls are necessary.

Generating a value help
You can also use the S10 Framework Utilities to have a search help generated automatically.
For details, see the "Generation" section in the documentation.

Example of generating a search help for a material:
Global search help
The next instruction " Global search helps" describes how to set up a search help as an SE24 class which is automatically invoked by the S10 Framework based on the domain name of an attribute.

Component: S10 Framework