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

How to search a dot in a string using search command?

Former Member
0 Likes
2,021

I want to change the format of an amount. For this i am writing the following code.

DO.

SEARCH w_l1amt FOR '.'.

IF sy-subrc IS INITIAL.

REPLACE '.' WITH ',' INTO w_l1amt.

w_pos = sy-fdpos.

ENDIF.

SEARCH w_l1amt FOR ','.

IF sy-subrc IS INITIAL.

IF w_pos NE sy-fdpos.

REPLACE ',' WITH '.' INTO w_l1amt.

ENDIF.

ENDIF.

IF sy-subrc <> 0.

EXIT.

ENDIF.

ENDDO.

I am getting 2 problems.

1) the line SEARCH w_l1amt FOR '.' is not getting success i.e. its not recognising dot.

2) As i am writing do if i replace dot manually in debug when it come to replace comma its replacing the comma which i have done in the debug also to dot again when the do repeats.

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
956

Hi ,

Dot is a special pattern character , so give three dots while searching

search str for '...'. it will search for dot.

Hi ,

Dot is a special pattern character , so give three dots while searching

search str for '...'. it will search for dot.

2 REPLIES 2
Read only

Former Member
0 Likes
957

Hi ,

Dot is a special pattern character , so give three dots while searching

search str for '...'. it will search for dot.

Read only

0 Likes
956

thanks. it had helped me a lot.