Type-Ahead and Full Text Fuzzy Search on SAP HANA
This tutorial gives a brief explanation of how to use the enhanced Search Help Functionality such as Type-Ahead and Full Text Fuzzy Search on SAP HANA delivered with SAP NetWeaver as ABAP 7.4 SP 5.
With SP 5 functionality of Search Help Object can be enhanced in order to display possible search results and further values in a drop-down box below the search field. This function assists the end user who is searching for the desired entry and therefore increases its productivity.
How to enable the Type-Ahead Search in a Search Help object
We are using a demo ABAP report which displays input sales using classic Dynpro programming.
Report z_search_help_demo
CALL SCREEN 4242.
Module user_command_4242 INPUT.
CHECK su-ucomm = 'BACK' OR sy-ucomm = 'CANC' OR sy-ucomm = 'EXIT'.
LEAVE TO SCREEN 0.
ENDMODULE.
MODULE status_4242 OUTPUT
SET PF_STATUS 'STATUS_4242'
SET TITLEBAR 'TITLE_4242'
ENDMODULE.
After executing the above report we will see three of the input field have a search help assigned to it
How to activate Type-Ahead function in a Dynpro
1) Navigate to the relevant search help object CALL SCREEN 4242.
2) And activate the type ahead functionality
3) Now we will see new area enhanced options
4) Change the edit mode and enable Proposal search for input field option which is one relevant for Type Ahead Search Method. This option is a database agnostic.
5) Save and activate the modified object
6) Now back to the report we need to tell the Dynpro run-time specifically that it shall enable the activate the Type-Ahead Functionality by simply passing the names of relevant input fields to display.
Module type_ahead_4242 OUTPUT
cl_dsh_dynpro_properties=>enable_type_ahead(
fields = VALUE #( ( CONV string( 'ZDEMO_S_SNWD_BPA-BP_ID') )
( CONV string( 'ZDEMO_S_SNWD_BPA-COMPANY_NAME') )
"(CONV string( 'ZDEMO_S_SNWD_BPA-EMAIL_ADDRESS' ) )
ENDMODULE.
7) Now activate the modified object and execute the report we will see the magnifying glass on input fields which will enable Type Ahead Search.
Enabling multi-column Full Text Search in Search Help object
1) Go to Search Help Object
2) Select Full Text Fuzzy Search if the type ahead option is already selected
3) The corresponding columns must be marked as import or export parameters
4) Now activate and run the modified report
Note: This option is only data specific and currently only supported on SAP HANA Database.
5) Now the selection method support full text search, therefore, we will see a multi-column full-text performed
How to specify the accuracy value of Full Text Search and understanding its impact on the Search result.
1) Go to Search Help Object
2) Decrease or Increase the accuracy value in order to increase or decrease the Error-Tolerant Full Text Search respectively.
3) Activate and run the report