‎2008 Jul 16 12:02 PM
Hi all,
I have one phone number field. and the numbers are like 123-456-7891.
Now i need convert this so that it should not allow to contain spaces, hyphen, slash etc. while downloading it to a file.
It should contain only numbers.
How can we do this.
can anybody please help me?
Thanks,
sudheer
‎2008 Jul 16 12:05 PM
HI,
First replace '-' by space using REPLACE
then use CONDENSE to remove spaces.
Try this .
‎2008 Jul 16 12:05 PM
HI,
First replace '-' by space using REPLACE
then use CONDENSE to remove spaces.
Try this .
‎2008 Jul 16 12:05 PM
Use replace all occurrences ..
replace all occurrences of '-' in v_phone with ''.
condense v-phone.
‎2008 Jul 16 12:07 PM
Hi,
try this...
declar a variable type of N.
move the values to that variable.
var1 type N.
loop at itab.
move itab-telno to var1.
move var1 to itab-telno.
modify itab.
endloop.
Edited by: prabhu p on Jul 16, 2008 1:07 PM
‎2008 Jul 16 12:07 PM
Hi
Do in this way.
REPLACE ALL OCCURRENCES OF '-' IN gv_number WITH ''.
‎2008 Jul 16 12:08 PM
Hi,
Please check this,
DATA:
w_num(15) type c value '123-456-7891' .
CONSTANT : c_hypen type value '-'.
REPLACE ALL OCCURRENCES OF c_hypen
IN w_num WITH space.
CONDENSE w_num .Regards
Adil
‎2008 Jul 16 12:16 PM
Hi
Try this...
Data: str1(20) type c, str(2) type c, char1 type c.
Data: len type i, cnt type i value 0.
str1 = '123-456-7891'.
str2 = ''.
len = STRLEN( str1 ).
While ( i <= len )
char1 = str1+i(1).
IF char1 CO '123456789'.
CONCATENATE str2 char1 into STR2.
ENDIF.
i = i + 1.
EndWhile
WRITE:/ STR2.
Hope this would help you.
Murthy
Edited by: Kalyanam Seetha Rama Murthy on Jul 16, 2008 1:17 PM
‎2008 Jul 16 12:19 PM
Hello
data: str1(10),
str2(10),
str3,
len type i.
str1 = '123-456+09'.
len = strlen( str1 ).
do len times.
str3 = str1(1).
if str3 co '0123456789'.
concatenate str2 str3 into str2.
endif.
shift str1 left.
enddo.
write: str2.
‎2008 Jul 16 1:07 PM
Hi sudheer,
if you are on ECC600 (ABAP640) or higher, you can use regular expressions
DATA: LV_PHONE TYPE STRING VALUE '123-456-7891' .
REPLACE ALL OCCURENCES OF REGEX [^0-9] IN LV_PHONE WITH ''.
should remove all non-numeric characters.
Regards,
Clemens
Edited by: Clemens Li on Jul 16, 2008 2:08 PM