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: 

Find a pattern in a Characterfield

771

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

Kiran_Valluru
Active Contributor
660

Hello Zeynep,

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

hope this helps!

Regards,

Kiran

5 REPLIES 5

matt
Active Contributor
660

"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/

Kiran_Valluru
Active Contributor
661

Hello Zeynep,

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

hope this helps!

Regards,

Kiran

0 Kudos
660

Hi Kiran,

it work's. Thank you so much!

Best, Zeynep

RaymondGiuseppi
Active Contributor
660

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

0 Kudos
660

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