SAP Search-Help Exit-Add Default Value

You can set a default value on search-help fields, but these are set as EQ values. If you like to set default with other operation like LE, GE etc then you would have to implement search help exit and write code there.

FUNCTION zsearchhelp_exit.
*"----------------------------------------------------------------------
*"*"Local Interface:
*"  TABLES
*"      SHLP_TAB TYPE  SHLP_DESCR_TAB_T
*"      RECORD_TAB STRUCTURE  SEAHLPRES
*"  CHANGING
*"     REFERENCE(SHLP) TYPE  SHLP_DESCR_T
*"     REFERENCE(CALLCONTROL) TYPE  DDSHF4CTRL
*"----------------------------------------------------------------------

DATA ls_shlp_selopt LIKE LINE OF shlp-selopt.

* default value for begga and endda in search-help
IF callcontrol-step = /srmerp/if_wf_process_c=>gc_shlp_evt_presel1.
"BEGDA
ls_shlp_selopt-shlpname  = shlp-shlpname.
ls_shlp_selopt-shlpfield = if_hrpiq00ad_query_pd_s0=>gc_field_begda.
ls_shlp_selopt-sign      = if_fsbp_const_range=>sign_include.
ls_shlp_selopt-option    = if_fsbp_const_range=>option_less_equal.
ls_shlp_selopt-low       = sy-datum.
APPEND ls_shlp_selopt TO shlp-selopt.

"ENDDA
ls_shlp_selopt-shlpname  = shlp-shlpname.
ls_shlp_selopt-shlpfield = if_hrpiq00ad_query_pd_s0=>gc_field_endda.
ls_shlp_selopt-sign      = if_fsbp_const_range=>sign_include.
ls_shlp_selopt-option    = if_fsbp_const_range=>option_greater_equal.
ls_shlp_selopt-low       = sy-datum.
APPEND ls_shlp_selopt TO shlp-selopt.

callcontrol-step = /srmerp/if_wf_process_c=>gc_shlp_evt_select.
ENDIF.

ENDFUNCTION.

Leave a Reply