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

standard function module for phone number conversion

Former Member
0 Likes
1,752

Hi friends,

I have a phone number in the format 209) 983-6551 but i should convert into the following format 209-983-6551.

how can i convert it..

Do we have any standard function module for this conversion

Regards

Srinivasarao

7 REPLIES 7
Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,080

if its always in this format

then

replace first occurrence of ')' in phone_no with '-'.

condense phone_no no-gaps.

Edited by: Keshu Thekkillam on Sep 10, 2009 6:31 PM

Read only

0 Likes
1,080

keshu if the format would have been same everytime then it works perfectly no dought about that...

But the format changes every time and its determined at run time... so as per my knowledge i prefer function module would be best.... for such a scenario sap might have given some function module.....

did any any one faced such a problem ..if so, let me know ur approach..

Regards

Srinivasarao

Read only

0 Likes
1,080

Hi,

So, is the requirement that the number could contain unwanted brackets and spaces? Or could there be other non-numeric characters?

There may be a function module to clean up phone numbers but I wouldn't expect so. It should be simple to write some code to format the data using the approach Keshu Thekkillam has suggested.

Regards,

Nick

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
1,080

I dont thik so there is any FM.

First of all how the phone no gets updated like this?

You can restrict it there itself right.

Read only

0 Likes
1,080

it could come with brackets or it could come with country code,or it could come as just numbers without any brackets or country code

Regards

Srinivasarao

Read only

0 Likes
1,080

Hello

1. Use FM 'SF_SPECIALCHAR_DELETE'. Result: 209) 983-6551 -> 2099836551

2. Use FM 'RKD_WORD_WRAP' with textline = 2099836551 and outputlen = 3. You will have follow:

209

893

655

1

3. Concatenate this lines separated by '-' and last one digit concatenate without delimiter.

Read only

0 Likes
1,080

maroz helpfull. ..!!!!!