Application Development 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: 

How to remove characters other than numeric numbers from a field

Former Member
0 Kudos
331

Hi All,

I have issue regarding removing characters other than numeric numbers from a field.

<b>How we can remove characters other than numeric numbers from a field!</b>

Ex:

<b>* Begin Of Modification - 671235785</b>

Now from above commented line of code i want to remove all the characters <b>* - Begin Of Modification and all spaces and capture 671235785 only.</b>

How can i solve this issue!

Thanks in advance.

Thanks,

Deep.

1 ACCEPTED SOLUTION

Former Member
0 Kudos
215

please go through the link

regards

shiba dutta

4 REPLIES 4

Former Member
0 Kudos
216

please go through the link

regards

shiba dutta

Former Member
0 Kudos
215

data : len type i,

pos type i,

v_temp,

f1(15).

len = strlen( str ).

do len times.

v_temp = str+pos(1).

if v_temp ca '0123456789.'.

concatenate f1 v_temp into f1.

endif.

pos = pos + 1.

enddo.

in f1 you have the required value

Regards

Ravi

0 Kudos
215

data: str(100) type c.

data: str_n type string.

data: str_c type string.

data: len type i.

data: ofst type i.

str = '#ABCD%12344'.

len = strlen( str ).

do.

if ofst = len.

exit.

endif.

if str+ofst(1) co sy-abcde.

concatenate str_c str+ofst(1) into str_c.

else.

concatenate str_n str+ofst(1) into str_n.

endif.

ofst = ofst + 1.

enddo.

write:/ str.

write:/ str_c.

write:/ 'spacial chracter',20 str_n.

kishan negi

Former Member
0 Kudos
215

Hi Deep,

Check out this sample of code :.

DATA : mytext TYPE char50,

mytext1 TYPE char50,

mytext2.

mytext = '* Begin Of Modification - 671235785'.

DATA : i TYPE i,

len TYPE i.

i = 0.

len = STRLEN( mytext ).

DO len TIMES.

IF mytext+i(1) CA '0123456789'.

mytext2 = mytext+i(1).

CONCATENATE mytext1 mytext2 INTO mytext1.

ENDIF.

i = i + 1.

ENDDO.

WRITE 😕 mytext1.

-SatyaPriya