Search Help exit to allow search results to be return even if text case does not matchThe search help exit allows you to modify functionality of search help. If you are creating you own search help exit first copy
function module F4IF_SHLP_EXIT_EXAMPLE into your own function group and modify it appropriately.
This example shows you how to allow a user to enter their search string in any case(upper or lower) but to find values of all cases. See here
other example to add field to search help exit.
data: it_shlpselop type DDSHSELOPS,
wa_shlpselop like line of it_shlpselop,
gd_wgbez type h_zmatsearch-wgbez,
gd_usrwgbez type h_zmatsearch-wgbez,
gd_tabix type i,
it_shlp type SHLP_DESCR-fielddescr,
wa_shlp like line of it_shlp.
*...
IF CALLCONTROL-STEP = 'SELECT'.
loop at shlp-selopt into wa_shlpselop.
if wa_shlpselop-shlpfield eq 'WGBEZ'.
gd_usrwgbez = wa_shlpselop-low.
EXPORT gd_usrwgbez to MEMORY ID 'ID1234'.
delete shlp-selopt index sy-tabix.
endif.
endloop.
* PERFORM STEP_SELECT TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL RC.
* IF RC = 0.
* CALLCONTROL-STEP = 'DISP'.
* ELSE.
* CALLCONTROL-STEP = 'EXIT'.
* ENDIF.
EXIT. "Don't process STEP DISP additionally in this call.
ENDIF.
The next change would need to be performed within the IF CALLCONTROL-STEP = 'DISP' section. This step allows you to loop around all the retrieved selection values and add to them or delete those not required. This data is stored in table RECORD_TAB (record_tab-string) as one long string value. You therefore need to read table SHLP for the field you are interested in to locate position of value within this string. ALthough from my experience this does not seem to be accurate, for example the last time I used this code the value return was always exactly double that required. Not really sure why but seemed to be consistant so was simple able to divide by 2 to get the correct value. IF CALLCONTROL-STEP = 'DISP'.
IMPORT gd_usrwgbez to gd_usrwgbez FROM MEMORY ID 'ID1234'.
if not gd_usrwgbez is initial.
TRANSLATE gd_usrwgbez TO UPPER CASE.
Loop at record_tab.
gd_tabix = sy-tabix.
read table shlp-fielddescr into wa_shlp
with key tabname = 'H_ZMATSEARCH'
fieldname = 'WGBEZ'.
wa_shlp-offset = wa_shlp-offset / 2.
*
gd_wgbez = record_tab-string+wa_shlp-offset(20).
TRANSLATE gd_wgbez TO UPPER CASE.
if not gd_wgbez cp gd_usrwgbez.
delete record_tab index gd_tabix.
endif.
endloop.
endif.
* PERFORM AUTHORITY_CHECK TABLES RECORD_TAB SHLP_TAB
* CHANGING SHLP CALLCONTROL.
EXIT.
ENDIF.
Website Navigation to related information
|
||||||