Application Development and Automation 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: 
Read only

Find a pattern in a Characterfield

2,040

Hello together,

I am trying to validate a character value.

I have two character fields and I would like to check if field c2 contains the value of c1. The problem is, that c2 can contain more characters than c1.

For example:

C1 has the value: edit_row_example

C2 has the value: hello.test_th edit_row_example

I would like to check if the pattern in C1 exists in C2. I tried to use CO CP operaters. However it doesnt work really. Does anyone has an idea? Thanks!

1 ACCEPTED SOLUTION
Read only

Kiran_Valluru
Active Contributor
1,929

Hello Zeynep,

You would need to use CS (Contains String) here.. check for IF C2 CS C1...

hope this helps!

Regards,

Kiran

Hello together,

I am trying to validate a character value.

I have two character fields and I would like to check if field c2 contains the value of c1. The problem is, that c2 can contain more characters than c1.

For example:

C1 has the value: edit_row_example

C2 has the value: hello.test_th edit_row_example

I would like to check if the pattern in C1 exists in C2. I tried to use CO CP operaters. However it doesnt work really. Does anyone has an idea? Thanks!

5 REPLIES 5
Read only

matt
Active Contributor
1,929

"doesn't work really" isn't a very specific issue.

What have you tried, what were the results? Why were they not what you expected?

Do you know the CP isn't case sensitive (except in OpenSQL)? https://blogs.sap.com/2018/08/17/in-case-of-a-sensitive-range-apply-this-solution/

Read only

Kiran_Valluru
Active Contributor
1,930

Hello Zeynep,

You would need to use CS (Contains String) here.. check for IF C2 CS C1...

hope this helps!

Regards,

Kiran

Read only

0 Likes
1,929

Hi Kiran,

it work's. Thank you so much!

Best, Zeynep

Read only

RaymondGiuseppi
Active Contributor
1,929

Also you didn't search a Pattern (CP) but a String (C?)

Read only

0 Likes
1,929

Well I searched with CP to see if C1 fits in C2. CS was the solution