2011 Jun 02 5:23 PM
Hi experts,
I have to look for employees in the table PA0002 by name and first name.
I need that the searching without taking into account the accents, for example the results for 'JUAN' and 'JUÁN' must be the same.
Rigth now I have the following code:
data l_nombre type string.
l_nombre = 'JUAN'
and in PA0002 I have an employee whose name is JUÁN
if I do
select *
from pa002
where vorna like l_nombre.
I get 0 matches and I shouid get the the employee 'JUÁN'.
Thanks.
Hi,Try Select all into an internal table and then replace all 'À' with 'A' etc. then use Read Table to get the result you want.
2011 Jun 02 5:34 PM
I don't know of this will work, but you can try the fileds NCHMC and VNAMC instead of NACHN and VORNA. At least they're already in upper case. So this will at least eliminate that problem. And there is a secondary index on these fields, so that will improve performance.
After doing some testing, this suggestion will not work.
Rob
Edited by: Rob Burbank on Jun 2, 2011 2:04 PM
2011 Jun 02 6:37 PM
Hi Sara,
first of all: The subject Search is against any rule.
if you search for 'JUAN' you will not find 'JUÁN'.
If you want to allow similar entries, you can select all names and send them through Function module RS_COMPARE_WORDS_SIMILAR.
If it is only about accents, you may create an algorithm that will put a search term like 'JUAN' into a range containing JÚAN, JÙAN,JUAN,JÚÁN, JÙÀN,JÙÀN,..., just all possible combinations.
The algorithm will be recursive: Take a SEARCH term, find next vowel, create all search terms with a variation of the vowel (A,À and À for A) then apply this for all vaiations starting after first vowel. I think in Spanish you have also N and ñ that should be considered.
Regards,
Clemens
2011 Jun 03 7:56 AM
Hello Sara,
you can do the following: (if table is not very big)
1. Select all the fields of the table INTO it_table
2. REPLACE ALL OCCURRENCES OF 'é' IN it_table WITH 'e'. (repeat for all vowels)
3. SEARCH your name in it_table
See you!
2011 Jun 03 8:05 AM
Hi,Try Select all into an internal table and then replace all 'À' with 'A' etc. then use Read Table to get the result you want.
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 2 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |