SAP Tutorials Blog

 

 


DATA : legal_chars TYPE string

      VALUE 'ABCDEFGHIJKLMNOPQRSTUVWXYZ 0123456789.,-*_!?'.

DATA : lv_char_value(255). " give max length


lv_char_value = gv_string.

CHECK NOT ( lv_char_value CO legal_chars ).


lv_length = strlen( gv_string ).


DO lv_length TIMES.

  lv_i = sy-index - 1.

  IF NOT lv_char_value+lv_i(1) CO legal_chars.

    "We get the illegal char , do what you want

    lv_char_value+lv_i(1) = ' '.

  ENDIF.

ENDDO.


CLEAR : gv_string.

gv_string = lv_char_value.


Serkan AKKAVAK

Computer Engineer BSc

SAP Department Manager

Contact : serkurumsal@yandex.com