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: 

data matching function

Former Member
0 Kudos

hi,

may i know what function to use if having the below scenario.

i loop an internal table to move code to a variable. when the code in variable match with the code in the string then it is considered match.

my problem now is if the code in variable is ABC and in my string is ABCDDS then it is considered match as ABC is part of the string but in fact i have another code in the internal table which is ABCDDS.

i tried to use CP but cannot work. the code size is 10.

example

in internal table, there are code AAS, ABD, ABC, ABCDDS, ABCW

in the string, 56:091007JENNYUSD200,00<b>ABCDDS</b>PG607

thanks

3 REPLIES 3

former_member186143
Active Contributor
0 Kudos

so is it a problem to have 2 matches ??

you return a table with records that have matched and/or not I guess ??

kind regards

arthur

0 Kudos

hi,

in the string the code is ABCDDS. while loop the code internal table, i use CP to do matching which is not accurrate.

as i said, in the code internal table there are various code: ABC and also ABCDDS. when loop on code ABC, if i use CP, it will consider match as ABC in the string but what i need is the code ABCDDS.

hope you can understand.

thx

0 Kudos

so to you're internal table you add a length field.

put the length of the string for each field

sort you're table on the lenght of the string in reverse order

and if the first match comes it is for the longest fieldvalue that can occur and not for the smallest or undefined

kind regards

arthur