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

Syntax Problem in ABAP statement

Former Member
0 Likes
947

Hi all,

DATA: text TYPE string,

IF text CO =  ' @#$%^&*()_+-=<>?:"{}|[]\; '.

 ELSE.
 Message error   
ENDIF.

I want to include ' in the IF condition, Please Suggest.

regards,

Mukundan.R

1 ACCEPTED SOLUTION
Read only

ThomasZloch
Active Contributor
0 Likes
910

use

''

Thomas

7 REPLIES 7
Read only

ThomasZloch
Active Contributor
0 Likes
911

use

''

Thomas

Read only

0 Likes
910

Thanks to everybody.

Cheers

Mukundan

Read only

Former Member
0 Likes
910

Hi,

Use the escape character `` to represent apostrophe


IF text CO =  ' @#$%^&*()_+-=?:"{}|[]\;`` '.
 
 ELSE.
 Message error   
ENDIF.

Vikranth

Read only

Former Member
0 Likes
910

Hi,

Please be more elaborate.

Thanks,

Harini

Read only

former_member222860
Active Contributor
0 Likes
910

Check this

DATA: text type string value ''''.

IF text CO  ' @#$%^&*()_+-=?:"{}|[]\; '' '.
 
 ELSE.
 Message error.
ENDIF.

write:/ text.

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
910

Remove '=' sign.

IF text CO '@#$%^&*()_+-=?:"{}|[]\;'.

if text co `'`.

endif.

else.

endif.

Read only

SuhaSaha
Product and Topic Expert
Product and Topic Expert
0 Likes
910

Hello,

I think the error may be because you are using '=' with CO operator.

And just FYI, for apostrophe(') you have to use an escape character which is an apostrohe(') itself as suggested by Thomas.

BTW i removed '=' from your code & it compiled

DATA: V_TEXT TYPE STRING.

IF V_TEXT CO ' @#$%^&*()_+-=?:"{}|[]\; '.
ELSE.
*  MESSAGE ERROR
ENDIF.

BR,

Suhas