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

contains pattern syntax in abap

Former Member
0 Likes
4,616

Hi,

I want to check inside loop of itab ,whether my field f1(132) type c contains value '####',if it is true i have to code continue.so i created one var f2 like this

data:f2(20) type c value '########'.

my code:

loop at itab.

if f1 cp f2.

continue.

endif.

endloop.

but sy-tdpos contains 132 after if stmt.it should be 0 right? anybody have solution for this.please help me if u know..

Thanks & Regards,

Kavitha

3 REPLIES 3
Read only

Sandeep_Panghal
Product and Topic Expert
Product and Topic Expert
0 Likes
1,355

From f1 help : The character '#' has a special meaning. It serves as an escape symbol and indicates that the very next character should be compared "exactly".

Also if the CP is true it gives sy-fdpos as the first match.

Read only

Former Member
0 Likes
1,355

What is the purpose of this #???????

Try once with CA CL_ABAP_CHAR_UTILITIES=>HORIZONTAL_TAB....

Read only

Former Member
0 Likes
1,355

Hi ,

You should use "Find" or "Search" statemnt for this purpose. I am using the same and getting the output.

data : test type char10 value 'ABC',

test1 type char20 value 'HHJGJHGABCss'.

data : qw type i.

Find FIRST OCCURRENCE OF test in test1 match OFFSET qw.

write qw.

OUTPUT : 7 (Start counting from zero)

Hope this helps.