‎2008 May 05 10:51 PM
I have string "AA000PGS01901 , the string may be userdefined also
and i want to print only the numeric ....
plz help me....
‎2008 May 05 11:37 PM
Hi,
If for sure know the number of numeric values in the string then you can simply define a NUMC variable and move the string to it.. like...
data : num(8) type n.
data : str(13) type c.
num = str.
then num will be 00001901.
or you can write a simple subroutine to ignore all the alphabets...
PARAMETERS : p_str(25) TYPE c DEFAULT 'AA000PGS01901'.
DATA : l_len TYPE i.
DATA : l_num(25).
START-OF-SELECTION.
PERFORM get_num USING p_str CHANGING l_num .
WRITE : / p_str, / l_num.
FORM get_num USING value(str)
CHANGING value(num).
CONDENSE str. l_len = STRLEN( str ).
WHILE l_len > 0..
l_len = l_len - 1.
IF str+l_len(1) CA '0123456789'.
CONCATENATE str+l_len(1) num INTO num.
ENDIF.
ENDWHILE.
ENDFORM. " get_num
Let me know if you come across any simple method.
Thanks,
Pavan