Skip to Content
Author's profile photo Former Member

Smart Input Help / Suggested values


Smart value help allows to see the 5 last entries or a list of suggestion based on what you have entered.

You can see the application help for more details on the functionnalities :

Smart Input Help – Generic User Interface Functions – SAP Library

Smart value help script

First let’s have a look in the BSP application THTMLB_SCRIPTS, page scripts_.oo_smart_value_help.js

Here is the javascript that handles this functionality :

  Smart Value Help(SVH) – Handles the last five values and suggested values for a F4 Inputfield.

  There are two main types of F4
  1) Simple F4 – Values are ready on the popup
  2) Complex F4 – Values are not ready on the popup until user clicks search button Ex: F4 opens an Advanced Search view

  In the first case(simple F4) both last entries and f4 suggested values are provided, in the complex F4 only the last
  entries will be provided.

var thtmlbCSVHMangerSingleton = thtmlbClass.create();
thtmlbCSVHMangerSingleton.prototype = {
   alertTimerId:                 0,
   inputField:                   “”,
   sicfPath:                     “/webcuif/uif_callback”,
   lastFiveHandler:              “CL_THTMLB_SMART_VALUE_HELP”,
   svhHandler:                   “CL_THTMLB_F4HELP”,
   displayBackgroundSearch:      “backgroundSearch”,
   displayLastFive:              “lastFive”,
   displaySmartValueHelp:        “smartValueHelp”,
   saveInputFieldId:             “saveId”,
   timeDelayMS:                  200,
   helpId:                       “”,
   helpInputMapping:             “”, <%– value retrived by the backend –%>
   helpInputMappingParser:       “”, <%– value passed to the backend for F4 –%>
   helpOutputMapping:            “”,
   pageId:                       “”,
   helpType:                     “”,
   popupF4InputField:            “”, <%– inputfieldF4 used in a comples F4 popup –%>
   controller:                   “”,
   view:                         “”,
   svhType:                      “”, <%– backgroundSearch ,lastFive or both –%>
   numberOfCharacters:           1,
   tooManyRecords:               “(Too Many Records…)”,

Here we can see the handling classes for last five entries : CL_THTMLB_SMART_VALUE_HELP and for the suggested values : CL_THTMLB_F4HELP.

The attribute “numberOfCharacters” define the number of characters that need to be entered before the function is activated.

Below in the page we see the code that handles behaviour on key entered :

       <%– enter, shift or escape (hide the context menu if its opened)–%>
       <%– hide the context menu for function keys, capslock and other keys –%>
       contextMenu = document.getElementById(“thtmlb_contextMenu__items”);
       if ((charCode < 47 && !(charCode == 8 || charCode == 46 || charCode == 38 || charCode == 40 )) || ( charCode >= 112 && charCode <= 123))
             <%– backspace –%>
           else if (charCode == 8 ){


If you want suggested values to appear every time (and not only when you hit backspace) you have to change the code like this (code added in green) :

<%– any other character –%>
                                    } else if (thtmlbCSVHManger.inputField.value.length >= thtmlbCSVHManger.numberOfCharacters ){
                                           <%–       thtmlbCSVHManger.alertTimerId = window.setTimeout(‘thtmlbCSVHManger.svhFrontEndSearch();’,thtmlbCSVHManger.timeDelayMS);   –%>
                                           thtmlbCSVHManger.alertTimerId = window.setTimeout(‘thtmlbCSVHManger.ajaxCallRequest(thtmlbCSVHManger.displaySmartValueHelp);’,thtmlbCSVHManger.timeDelayMS);

Handling class for Smart value help

So the class  CL_THTMLB_F4HELP is called to handle the request :


In this class we can see that the suggested values actually come from a search help (defined in SE11).

The search help has to use dialog type “Display value immediately”.

So basically, every field can be assigned a search help in order to get suggested values, in order to do that you need to assign a search help to the data element of the field.

Example : Address check/completion using an external Web Service.

I have defined a search help based on an exit :


In the function module ZDQE_SHLP_LIBRE I call the web service that will search for address.

I create a data element to enter a free text, with reference to this search help :


Important : for my need the class CL_THTMLB_F4HELP, METHOD HANDLE_REQUEST has to be modified by removing the * in prefiltering value, else values are filtered according to value entered in the field by the user, so you only see them if they contain the pattern defined with the *.

Now I can use my field to enter free address and get suggested values (example with french address) :


The web service I used return only one value (the closest to what the user entered), you can see here what happened after entering “rue jacques paris”, but of course you can have a list of results to choose from.

Assigned Tags

      You must be Logged on to comment or reply to a post.
      Author's profile photo Daniil Luzin
      Daniil Luzin

      Hello Benoit,

          why remove *? We have SVH working without '*' written into search field

      Author's profile photo Former Member
      Former Member
      Blog Post Author


      I mean I removed the below standard coding :

      * concatenate the gv_prefiltering_value with '*' to be used in prefiltering
         CONCATENATE gv_prefiltering_value '*' INTO gv_prefiltering_value.

      If you leave the * added in this code, then the values are filtered according to the pattern, for instance when I enter "rue jacques" it will never get me "rue Jean Jacques Rousseau" because then it wouldn't fit the pattern 'rue jacques*'.

      So it is why I add to remove it.

      But it depends on your needs, you can also leave it of course.


      Author's profile photo Former Member
      Former Member

      Hello Benoit!

      Very usefull blog! Thank you!

      But could you help me, i can't understand how could you change standard class CL_THTMLB_F4HELP, METHOD HANDLE_REQUEST and standard view scripts_.oo_smart_value_help.js?

      Did you make enhance or what? Maybe you changed standard class with your z-class? But how then make you z-class been call?

      I need in my case change the logic of CL_THTMLB_F4HELP, METHOD HANDLE_REQUEST but i don't whant to enhance it? Is There way to change the handler in SICF? Could you please explain this to me?

      I also tried to make a copy of BSP THTMLB_SCRIPTS with my ZTHTMLB_SCRIPTS and the insert a row in Table bsp_applc. But it didn't help. My Z-BSP didn't been called and everuthing was the same!

      Please provide me explanations!

      Regards, Roman

      Author's profile photo Former Member
      Former Member
      Blog Post Author


      Well I directly modified the standard code.

      But I guess eventually you can modify only the page scripts_.oo_smart_value_help.js to change the svh handler and put a z subclass of CL_THTMLB_F4HELP.


      Author's profile photo Former Member
      Former Member

      But how can i change scripts_.oo_smart_value_help.js . I can't modify or enhance it?

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      Well, like every standard object, with an access key.

      SE80, Application BSP THTMLB_SCRIPTS then you go to the page and click on the modify icon.

      Author's profile photo Former Member
      Former Member

      Sorry, but what ehp do you have? My SAP CRM EhP3 won't let me to do this)

      Author's profile photo Former Member
      Former Member
      Blog Post Author

      I have CRM 7.0 EHP3 also, and I don't see why you would not be able to modify it, what message are you getting ?

      Author's profile photo Former Member
      Former Member

      Hello Benoît ,

      very nice blog .

      Could you please share the FM Code .