Remove Invalid characters using by Program

How To Remove Invalid characters:-

*----------------------------------------------------------------------*
* Author      : Bloger                                                 *
* Description : This program helps for Remove Invalid characters       *
*----------------------------------------------------------------------*
    data: l_d_length like sy-index.
    data: l_d_offset like sy-index.
    data: charallowedupper(60) type c.
    data: charallowedlower(60) type c.
    data: charallowednumbr(60) type c.
    data: charallowedsondr(60) type c.
    data: charallowedall(240) type c.

*-- List of char. that are considered as allowed chars.

    charallowedupper = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
    charallowedlower = 'abcdefghijklmnopqrstuvwxyzäüöß°ÖÄÜØɺ'.
    charallowednumbr = '0123456789'.
    charallowedsondr = '!"§$%&/()=?{[]}\u180?`*+~;:_,.-><|@'''.
    concatenate charallowedupper charallowedlower charallowednumbr
    charallowedsondr into charallowedall.

*-- Move the source field to the result
    RESULT = SOURCE_FIELDS-FIELD_NAME.

*-- Start removing invalid chars.
    l_d_length = strlen( RESULT ).
    if not RESULT co charallowedall.
      do l_d_length times.
        l_d_offset = sy-index - 1.
        if not result+l_d_offset(1) co charallowedall.
          result+l_d_offset(1) = ''.
        endif.
      enddo.
    endif.
    translate RESULT to upper case.



*$*$ end of routine - insert your code only before this line         *-*
  ENDMETHOD.                    "compute_0PROD_DESCR



Note:- RESULT SOURCE_FIELDS-FIELD_NAME (FIELD_NAME should be replace your requied infoobject)



No comments:

Post a Comment

Ads: