Skip to Content
avatar image
Former Member

Finding the closest matching record to a string

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

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

2 Answers

  • Best Answer
    Mar 27, 2017 at 03:08 PM

    Check out the built-in function distance.

    Add comment
    10|10000 characters needed characters exceeded

  • Mar 27, 2017 at 03:56 PM

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

    <g>

    Rich

    Add comment
    10|10000 characters needed characters exceeded