Quantcast
Channel: ABAP Development
Viewing all articles
Browse latest Browse all 948

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.

 

I would like to share following code with u, so next time somebody has this requirement, less research has to be done.

 

r my requirement this solution works fine. I think you can use it as approach when u have similiar requirements

 

*&---------------------------------------------------------------------* *& 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. DATA: lt_return_tab        TYPE STANDARD TABLE OF ddshretval,       ls_search_help_infos TYPE dd30v. PARAMETER: p_shlp TYPE string DEFAULT 'Z_PROPSP'. 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 948

Trending Articles



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