Technology Blogs by Members
Explore a vibrant mix of technical expertise, industry insights, and tech buzz in member blogs covering SAP products, technology, and events. Get in the mix!
Showing results for 
Search instead for 
Did you mean: 
Former Member


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.

Labels in this area