function z_ab_prep_val_for_case_search.
*"--------------------------------------------------------------------
*"*"Local Interface:
*" IMPORTING
*" VALUE(I_TEXT) TYPE CSEQUENCE
*" VALUE(I_SIGN) TYPE CHAR1
*" VALUE(I_OPTION) TYPE CHAR2
*" EXPORTING
*" REFERENCE(ER_RANGE) TYPE STANDARD TABLE
*"--------------------------------------------------------------------
field-symbols: <low> type any.
field-symbols: <sign> type any.
field-symbols: <opt> type any.
field-symbols: <line> type any.
field-symbols: <linenew> type any.
field-symbols: <lownew> type any.
field-symbols: <tab> type standard table.
data: f_times type i.
data: f_text type string.
data: f_textnew type string.
data: f_insidel type i.
data: f_insidel2 type i.
data: ft_data type ref to data.
"create temp table and assign it to FS
create data ft_data like er_range.
assign ft_data->* to <tab>.
f_text = i_text.
"get lenght
f_times = strlen( f_text ).
"translate to upper case so we have always same start
translate f_text to upper case.
"append initial line to range and put first value into table
append initial line to er_range assigning <line>.
check sy-subrc eq 0.
assign component 'LOW' of structure <line> to <low>.
check sy-subrc eq 0.
<low> = i_text. "all in uppercase
assign component 'SIGN' of structure <line> to <sign>.
check sy-subrc eq 0.
<sign> = i_sign.
assign component 'OPTION' of structure <line> to <opt>.
check sy-subrc eq 0.
<opt> = i_option.
translate <low> to upper case.
"create entries for each other combination of cases
do f_times times.
f_insidel2 = sy-index - 1.
loop at er_range assigning <line>.
assign component 'LOW' of structure <line> to <low>.
check sy-subrc eq 0.
if f_text+f_insidel2(1) ca '*+' and ( i_option eq 'CP' or i_option eq 'NP' ).
else.
append initial line to <tab> assigning <linenew>.
check sy-subrc eq 0.
assign component 'LOW' of structure <linenew> to <lownew>.
check sy-subrc eq 0.
assign component 'SIGN' of structure <linenew> to <sign>.
check sy-subrc eq 0.
<sign> = i_sign.
assign component 'OPTION' of structure <linenew> to <opt>.
check sy-subrc eq 0.
<opt> = i_option.
<lownew> = <low>.
f_textnew = <lownew>+f_insidel2(1).
translate f_textnew to lower case.
<lownew>+f_insidel2(1) = f_textnew.
endif.
endloop.
append lines of <tab> to er_range.
refresh <tab>[].
enddo.
endfunction.
report zab_prepare_values_for_cs.
parameters: f_char40 type char40.
data: retcode, screen.
ranges: r_char40 for f_char40 .
field-symbols: <char40> like line of r_char40.
start-of-selection.
call function 'Z_AB_PREP_VAL_FOR_CASE_SEARCH'
exporting
i_text = f_char40
i_sign = 'I'
i_option = 'CP'
importing
er_range = r_char40[].
loop at r_char40 assigning <char40>.
write:/ <char40>-low.
endloop.