Skip to Content
0
Former Member
Nov 12, 2010 at 06:50 AM

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

550 Views

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.