Quantcast
Channel: SCN : Blog List - ABAP Development
Viewing all articles
Browse latest Browse all 943

Execute Searchhelp with Search Exit in Background

$
0
0

Hy everybody,

 

i recently had the requirement to get the values of an existing searchhelp. Pretty simple when u are dialog modus. But unfortunatly the requirement was, that the search help had to be called in backgroud without opening the searchhelp dynpros (it's called in a oData Service Implementation). I didn't want to recreate the existing search logic, because it wasn't a simple search help. Most of the logic has been put in a search help exit and i didn't want to write any kind of wrapper by myself or implement the search logic again. I would like to share following code with u, so next time somebody has this requirement, less research has to be done as i found nothing on scn. For my requirement this solution works fine, as all dynpro fields are supressed. I think you can use it as approach when u have similiar requirements. I've also provided the source as attachment.

If you are using this approach, test it well, as i made the experience, that search helps can be called in various ways & behaviour might be different on your system depending on release & user settings.

Any comments & improvements are kindly welcomed.

 

Have a nice day.

 

Best regards,

Michael

 

*&---------------------------------------------------------------------*
*& Report  ZZTAB_SHLP_BG *&
*&---------------------------------------------------------------------*
*& Albrecht Michael, 28.01.2015 *&
*&---------------------------------------------------------------------*
REPORT zztab_shlp_bg.
DATA:
lv_search_help      TYPE ddobjname,
lv_search_help_f4if TYPE shlpname,
lt_return_tab        TYPE STANDARD TABLE OF ddshretval,
ls_search_help_infos TYPE dd30v.
PARAMETER: p_shlp TYPE string DEFAULT 'Z_YOURHELP'.
START-OF-SELECTION.
lv_search_help = p_shlp.
lv_search_help_f4if = lv_search_help.
* Get Search Help Information
CALL FUNCTION 'DDIF_SHLP_GET'
EXPORTING
name          = lv_search_help
IMPORTING       dd30v_wa      = ls_search_help_infos
EXCEPTIONS
illegal_input = 1
OTHERS        = 2.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.
* Call Search Help in Background
CALL FUNCTION 'F4IF_FIELD_VALUE_REQUEST'
EXPORTING
tabname             = ls_search_help_infos-selmethod
fieldname           = ''
searchhelp          = lv_search_help
value               = '*'
display             = ' '
suppress_recordlist = 'X'
selection_screen    = ' '
TABLES
return_tab          = lt_return_tab
EXCEPTIONS
field_not_found     = 1
no_help_for_field   = 2
inconsistent_help   = 3
no_values_found     = 4
OTHERS              = 5.
IF sy-subrc <> 0.
* Implement suitable error handling here
ENDIF.

Viewing all articles
Browse latest Browse all 943

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>