2007 Mar 14 4:12 PM
I need to format ADRC-TEL_NUMBER and intiliaze it into my variable
It should be 10 digits, no spaces, dashes etc , only numbers
2007 Mar 14 4:18 PM
Hello,
Try like this:
data: l_in_string type SP_TELNO.
l_in_string = ADRC-TEL_NUMBER .
call function 'TELNUMBER_REMOVE_SPECIAL_CHAR'
changing telnumber = l_in_string.
write: l_in_string.
Regards,
vasanth
I need to format ADRC-TEL_NUMBER and intiliaze it into my variable
It should be 10 digits, no spaces, dashes etc , only numbers
2007 Mar 14 4:14 PM
2007 Mar 14 4:15 PM
Hi,
You can try something like this.
DATA: FIELD1(30) TYPE C VALUE '(905) 123-4567',
FIELD2(10) TYPE C,
LENGTH TYPE I.
LENGTH = STRLEN( FIELD1 ).
DO LENGTH TIMES.
IF FIELD1(1) NA '1234567890'.
MOVE SPACE TO FIELD1(1).
SHIFT FIELD1 LEFT CIRCULAR.
ELSE.
SHIFT FIELD1 LEFT CIRCULAR.
ENDIF.
ENDDO.
CONDENSE FIELD1 NO-GAPS.
WRITE FIELD1 TO FIELD2.
Also please check this function modules.
TELNUMBER_REMOVE_SPECIAL_CHAR
SX_NUMBER_REMOVE_CHAR
data: v_number type SP_TELNO.
v_number = '(905) 123-4567'.
CALL FUNCTION 'TELNUMBER_REMOVE_SPECIAL_CHAR'
CHANGING
telnumber = v_number.
Regards,
Ferry Lianto
2007 Mar 14 4:15 PM
I dont know the syntax to that
new_ADRC-TEL_NUMBER = something (ADRC-TEL_NUMBER)
is it something like that
Message was edited by:
Megan Flores
2007 Mar 14 4:17 PM
where should I go to get more information on these function modules. Thanks !
2007 Mar 14 4:18 PM
Hello,
Try like this:
data: l_in_string type SP_TELNO.
l_in_string = ADRC-TEL_NUMBER .
call function 'TELNUMBER_REMOVE_SPECIAL_CHAR'
changing telnumber = l_in_string.
write: l_in_string.
Regards,
vasanth
2007 Mar 14 4:18 PM
Hi
Check this example
DATA: V_TEL TYPE SP_TELNO.
V_TEL = '999-999-9999'.
CALL FUNCTION 'TELNUMBER_REMOVE_SPECIAL_CHAR'
CHANGING
telnumber = V_TEL
.
WRITE: / V_TEL.
Thanks
Naren
2007 Mar 14 4:29 PM
'TELNUMBER_REMOVE_SPECIAL_CHAR'
does not reduce it to 10 digits
2007 Mar 14 4:36 PM
Hello,
Hello,
Try like this:
data: l_in_string type SP_TELNO.
l_in_string = ADRC-TEL_NUMBER .
call function 'TELNUMBER_REMOVE_SPECIAL_CHAR'
changing telnumber = l_in_string.
write: l_in_string(10).
Regards,
Vasanth
2007 Mar 14 4:37 PM
Hi,
Have you tried my custom sample code above?
What is the value of your ADRC-TEL_NUMBER?
Regards,
Ferry Lianto
2007 Mar 14 4:38 PM
2007 Mar 14 6:21 PM
Vasanth, your code works, almost. But it takes the first 10 digits from the left, I need the first 10 digits from the right as some of my numbers are more than 10 digits cos they have 0's before them and chopping them from the left is dropping the numbers from the right. For eg. I have a number 01977-554411, This becomes 0197755441. But it should actually become 1977554411
Thanks
2007 Mar 14 6:26 PM
Hi,
Please try this.
data: l_in_string type SP_TELNO,
l_phone(10) type c.
l_in_string = ADRC-TEL_NUMBER .
call function 'TELNUMBER_REMOVE_SPECIAL_CHAR'
changing telnumber = l_in_string.
if l_in_string(1) = '0'.
move space to l_in_string(1)
condense l_in_string no-gaps.
endif.
write l_in_string to l_phone.