Application Development Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 

Finding the closest matching record to a string

0 Kudos

I need assistance with matching the closest matching record. My requirment in short is I have an internal table that has about 10 records that are name of cities. A user will type in a string and I have to get the record with most letters matching to the supplied string Example:

|Itab

1 |Cape Town

2 |New York

3 |Johannesburg

So if a user types in "huhannesbarg", this string should be matched to Johannesburg as the closest matching record. I will really appreciate your assistance if you experts can maybe provide a function module I can use or just code

Regards Dzuni

1 ACCEPTED SOLUTION

horst_keller
Product and Topic Expert
Product and Topic Expert

Check out the built-in function distance.

3 REPLIES 3

horst_keller
Product and Topic Expert
Product and Topic Expert

Check out the built-in function distance.

Thanks, managed to use this and it worked perfectly

former_member182550
Active Contributor

Closest match in another sense - Use the SoundEx() function to determine if two cities sound like each other when spoken out loud.

<g>

Rich