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

Remove SPL character from the string.

Former Member
0 Likes
645

Hi All,

I need to remove the ANY SPL character from the given string.

For eg.

If the input = 1234#890.

then the output should be

1234890.

Thanks in advance.

Shiva.

3 REPLIES 3
Read only

Former Member
0 Likes
563

Use this Logic:

report:test.
data:value TYPE string VALUE '1234#890',
      num TYPE i,
      result TYPE char35,
BEGIN OF atext_tab OCCURS 0 ,
  text TYPE c,
  END OF  atext_tab.
CALL FUNCTION 'SOTR_SERV_STRING_TO_TABLE'
  EXPORTING
    text                      = value
*   FLAG_NO_LINE_BREAKS       = 'X'
   LINE_LENGTH               = 1
*   LANGU                     = SY-LANGU
  tables
    text_tab                  = atext_tab
          .

LOOP AT atext_tab .
  if atext_tab-text ca '! @ # $ % ^ & * '.
      delete atext_tab INDEX sy-tabix.
      else.
       CONCATENATE result atext_tab-text  into result.
    endif.
ENDLOOP.
WRITE result.

Read only

Former Member
0 Likes
563

also can try like, by using CONTAINS NOT-CN, we can achieve this, but, need to write all 0 to 9 and A to Z characters in CONTIANS NOT synstax.

thanq

Read only

Former Member
0 Likes
563

Thanks.