SAP Tech Pro

SAP Technical Blog
Topprice Price Comparison

How to get all fields programmatically from SAP Search help

How to get all fields programmatically from SAP Search help

When we select a value in the search help the function module 'F4IF_FIELD_VALUE_REQUEST' returns only one field though search help contains many fields. In order to get all the fields of the selected row in the return table lt_return, create a search exit as show below and set callcontrol-retallflds = abap_true.  This will return all the fields of the selected row of the value list.

The code below will display the values of your search help.


Data: lt_return      TYPE STANDARD TABLE OF ddshretval.

  CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
    EXPORTING
      tabname           = ''
      fieldname         = ''
      searchhelp        = 'Z_YOUR_SEARCH_HELP’
      dynpprog          = sy-repid
      dynpnr            = sy-dynnr
    TABLES
      return_tab        = lt_return
    EXCEPTIONS
      field_not_found   = 1
      no_help_for_field = 2
      inconsistent_help = 3
      no_values_found   = 4
      OTHERS            = 5.
  IF sy-subrc <> 0 OR lt_return IS INITIAL.
    RETURN.
  ENDIF.

Create a Search Help exit and set the callcontrol-retallflds = ABAP_TRUE. stpadmin01

FUNCTION Z_SHEARCH_HELP_EXIT.
*"--------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      SHLP_TAB TYPE  SHLP_DESCT
*"      RECORD_TAB STRUCTURE  SEAHLPRES
*"  CHANGING
*"     VALUE(SHLP) TYPE  SHLP_DESCR
*"     VALUE(CALLCONTROL) LIKE  DDSHF4CTRL STRUCTURE  DDSHF4CTRL
*"--------------------------------------------------------------------

callcontrol-retallflds = abap_true.

ENDFUNCTION. 

Add comment

Before Buying, Compare Prices at Topprice.in

Topprice.in