Search Help exit- Used to enhance search helps by adding new fields or functionalityThe 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. For example if you add a new field to the
parameter list that is not contained on the selection method you can manually populate it within the search
help exit. Another use for the search help exit would be to allow user to enter search string in any case and return all matching results
irrespective for case.
Example:
To find position of personnel number (PERNR) within elemenory search
help M_PREMN you would use the following code:
data: it_shlp type SHLP_DESCR-fielddescr,
wa_shlp like line of it_shlp.
Loop at record_tab.
read table shlp-fielddescr into wa_shlp
with key tabname = 'M_PREMN'
fieldname = 'PERNR'.
You could then use this information in the following way, for
example, to find a persons organisation unit:
Also please note this offset value is not always correct, i have had it return a value double that that was required,
so had to simply divide returned value by 2. Not sure why!!
select orgeh endda
up to 1 rows
from pa0001
into (ld_orgeh,ld_endda)
where pernr eq record_tab-string+wa_shlp-offset(8)
“pernr length is 8
order by endda descending.
endselect.
select single orgtx
from t527x
into ld_orgtxt
where orgeh eq ld_orgeh and
sprsl eq sy-langu and
( endda ge sy-datum and
begda le sy-datum ).
If you have added a new field to the end of the parameters list
the next step is to populate it by adding this data to the end of
the record_tab string:
concatenate record_tab-string ld_orgtxt into record_tab-string.
modify record_tab.
endloop.
Website Navigation to related information
|
||||||