‎2009 Sep 10 1:53 PM
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
‎2009 Sep 10 1:59 PM
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
‎2009 Sep 10 2:10 PM
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
‎2009 Sep 10 2:14 PM
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
‎2009 Sep 10 2:16 PM
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.
‎2009 Sep 10 2:19 PM
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
‎2009 Sep 10 2:25 PM
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.
‎2009 Sep 10 2:34 PM