ABAP Add SearchHelp on Parameter


ABAP Add SearchHelp on Parameter: a step-by-step tutorial how to add a custom Search Help / Value Request for a Parameter in Selection screen in ABAP Code.

ABAP Add SearchHelp on Parameter

In order to add a Search Help or Value Request for a parameter on Selection Screen, you have two alternative

  • Create a SAP Custom Search Help for the Element of the parameter through the tcode SE11.
  • On Selection-screen action, write some code and get more flexibility to handle the value and filter them.


The main action/ event to catch if you want to add the Search help is AT SELECTION-SCREEN ON VALUE-REQUEST FOR PARAMETER.

In this event, you can fill the list with value which will displayed in SAP Popup as table and the user can selection one of them. Use the SAP Standard Function F4IF_INT_TABLE_VALUE_REQUEST to handle the display and the selection.

The steps to be followed in ABAP code :

  1. Retrieve list of Search (Use a ABAP Select query)
    • RETFIELD : Name of Parameter
    • WINDOW_TITLE : Title of SAP PopUp windows
    • VALUE_TAB: list of Value to display
    • RETURN_TAB: List of Selected Lines
  3. Read the value selected

ABAP Add SearchHelp on Parameter: Sample Code

This sample ABAP snippet will help you add a custom Value Request or a Search Help for parameter in Selection option screen.

The parameter P_TABLE in this case is a SAP DDIC Table Name.
Note that the reference SAP Table for Tables is DD02L and DD02T for Text (SAP Table Description).
NB: Caution about the number of Table entries to be retrieved. (in the example, only SAP custom tables are considered)


  " Structure of SAP Value Request PopUp Table value
  TYPES: BEGIN OF ty_tab,
            tabname LIKE dd02t-tabname,
            ddtext  LIKE dd02t-ddtext,
         END OF ty_tab.

  " Table for Value Request Data Selection
  DATA: lt_entries TYPE TABLE OF ty_tab .

  " Selected line from the Value Request SAP PopUp
  DATA: lt_return TYPE TABLE OF ddshretval.
  FIELD-SYMBOLS: <fs_return> LIKE LINE OF lt_return.

  REFRESH lt_entries[].

  " Retrieve list of value                                      "
   " DD02L : SAP DDIC Table for Tables
   " DD02T : SAP DDIC Tables Description (Text)
    SELECT tabname ddtext FROM dd02t
      INTO TABLE lt_entries
      WHERE tabname Like 'Z%'      " Only SAP Custom Table
      AND   ddlanguage = sy-langu. " Only for SAP connected Language

  " Build Table PopUp for Value Request                         "
              ddic_structure   = ' '
              retfield         = 'P_TABLE'
              pvalkey          = ' '
              dynpprog         = ' '
              dynpnr           = ' '
              dynprofield      = ' '
              stepl            = 0
              window_title     = 'Select the DDIC Table'
              value            = ' '
              value_org        = 'S'
              multiple_choice  = ' '
              display          = ' '
              callback_program = ' '
              callback_form    = ' '
              value_tab        = lt_entries
              return_tab         = lt_return
              parameter_error  = 1
              no_values_found  = 2
              OTHERS           = 3
  IF sy-subrc <> 0.
    MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno
            WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

  " Read the Selected line for SAP Parameter Custom Search Help "
  READ TABLE lt_return ASSIGNING <fs_return> INDEX 1.
  IF sy-subrc = 0.
    p_table = <fs_return>-fieldval.

For more detail about SAP search help, check Search Helps