Convert to amount in words
hi,
i want a procedure that convert a amount (number) to amount in words
From that link ->
create or replace function spell_indian_money
( p_number in number )
return varchar2
as
type myArray is table of varchar2(255);
l_str myArray := myArray( ' Thousand ',
' Lakh ',
' Crore ',
' Arab ',
' Kharab ',
' Shankh ' );
l_num varchar2(50) default trunc( p_number );
l_return varchar2(4000);
begin
if ( substr(l_num, length(l_num)-2, 3) <> 0 )
then
l_return := to_char(
to_date(
substr(l_num, length(l_num)-2, 3),
'J' ),
'Jsp' );
end if;
l_num := substr( l_num, 1, length(l_num)-3 );
for i in 1 .. l_str.count
loop
exit when l_num is null;
if ( substr(l_num, length(l_num)-1, 2) <> 0 )
then
l_return := to_char(
to_date(
substr(l_num, length(l_num)-1, 2),
'J' ),
'Jsp' ) || l_str(i) || l_return;
end if;
l_num := substr( l_num, 1, length(l_num)-2 );
end loop;
if to_char( p_number ) like '%.%'
then
l_num := substr( round( p_number, 2), instr( p_number, '.' )+1 );
if l_num > 0
then
l_return := l_return || ' And '
|| to_char(
to_date(
l_num,
'J' ),
'Jsp' )
|| ' Paise';
end if;
end if;
return l_return;
end spell_indian_money;
create or replace
function spell_number_french( p_number in number )
return varchar2
as
begin
return replace( replace( replace( replace( replace(
replace( replace( replace( replace( replace(
replace( replace( replace( replace( replace(
replace( replace( replace( replace( replace(
replace( replace( replace( replace( replace(
replace( replace( replace( replace( replace(
replace( replace( replace( replace( replace(
replace( replace( replace( replace( replace(
replace(
lower( spell_number( p_number ))
, 'duodecillion', 'bidecillion' )
, 'quintillion' , 'cintillion' )
, 'billion' , 'milliard' )
, 'thousand' , 'mille' )
, 'hundred' , 'cent' )
, 'ninety' , 'quatre-vingt-dix')
, 'eighty' , 'quatre-vingt' )
, 'seventy' , 'soixante-dix' )
, 'sixty' , 'soixante' )
, 'fifty' , 'cinquante' )
, 'forty' , 'quarante' )
, 'thirty' , 'trente' )
, 'twenty' , 'vingt' )
, 'nineteen' , 'dix-neuf' )
, 'eighteen' , 'dix-huit' )
, 'seventeen' , 'dix-sept' )
, 'sixteen' , 'seize' )
, 'fifteen' , 'quinze' )
, 'fourteen' , 'quatorze' )
, 'thirteen' , 'treize' )
, 'twelve' , 'douze' )
, 'eleven' , 'onze' )
, 'ten' , 'dix' )
, 'nine' , 'neuf' )
, 'eight' , 'huit' )
, 'seven' , 'sept' )
, 'five' , 'cinq' )
, 'four' , 'quatre' )
, 'three' , 'trois' )
, 'two' , 'deux' )
, 'one' , 'un' )
, 'dix-six' , 'seize' )
, 'dix-cinq' , 'quinze' )
, 'dix-quatre' , 'quatorze' )
, 'dix-trois' , 'treize' )
, 'dix-deux' , 'douze' )
, 'dix-un' , 'onze' )
, '-un ' , '-une ' )
, 'un cent' , 'cent' )
, 'un mille' , 'mille' )
, 'une' , 'un' );
end spell_number_french;
please help me, it's urgentBad words..... :(
Hope you didn't go with this word next time here.
Regards.
Satyaki De.
Similar Messages
-
Converting the amount into words in different languages
Hi All,
Is there any FM to convert the amount into words in a specific language.
SPELL_AMOUNT FM is not working for some of the languages like portuguese, etc..
Any idea on this.
Thanks in Advance.Hi,
Use the FM:
CALL FUNCTION <b>'Y_AMOUNT_IN_WORDS'</b>
Hope it helps.
Reward if helpful.
Regards,
Sipra -
Convert total amount into words
Hi
My requirement is to convert total amount into words.
For this i used function module SPELL_AMOUNT.
But its giving wrong (i.e. problem is in the paise).
I tried with other function module also, its not giving output.
how i can get exactly correct output.
Reward points if helpful.Hi
execute this code .
REPORT ZCOVERTION.
TABLES SPELL.
DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '23.45'.
SY-TITLE = 'SPELLING NUMBER'.
PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
WRITE: 'NUMBERS', T_SPELL-WORD ,'and', T_SPELL-DECWORD.
FORM SPELL_AMOUNT USING PWRBTR PWAERS.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = PAMOUNT
CURRENCY = PWAERS
FILLER = SPACE
LANGUAGE = 'E'
IMPORTING
IN_WORDS = T_SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
ENDFORM. " SPELL_AMOUNT
Hope this will solve ur problem
Thanks
Krushna
oputput: -
Converting the amount in words
Hi ,
Issues is like if the amount is $137,510.82 for US currency it should give as ONE HUNDRED THIRTY-SEVEN THOUSAND FIVE HUNDRED TEN USD and 82/100.
But when the document currency is german in the check it should give as ONE HUNDRED THIRTY THOPUSAND AND 51082/100.
THE LOGIC SHOULD BE CURRENCY DEPENDENT.
HOW DO I DI THIS...following is a customized report to convert amount to words...
*& Report ZCFM_REPT_RUPEE_CONVERSION *
*This report is a copy of report 'ZRUPECO1' in Tengl server *
Date : 25-Oct-2006 *
Author : Amiya Shrivastava *
Title : Report to convert amount into words as per*
Indian spelling conventions *
Original Request number : DEVK917286 *
report zcfm_rept_rupee_conversion .
include zcfm_incl_rupee_conv_data.
*& Form COVERSION1
text
-->NUMBER text
-->ANS text
form coversion1 using number changing ans.
clear: gtab,
giritab,
giriline,
girijtab,
line ,
ans,
init, initnam, initno , init1,
cnam1, cnam2, cnam3,cnam4, point,jpoint,
kpoint,lpoint1, lpoint2,lpoint,fpoint,
cnt1 , cnt2, cnt3 ,
flhun, flth, flla, flcr1,flcr2, flchu1, flchu2, flpt, res.
refresh :
itab ,
ktab ,
jtab .
init = number.
init1 = init.
cnt1 = strlen( init ).
cnt2 = cnt1 - 1.
do cnt1 times.
initnam = init+0(1).
shift init by 1 places left.
if initnam = '.'.
cnam1 = init1+0(initno).
endif.
initno = initno + 1.
enddo.
do cnt1 times.
cnam2 = init1+0(1).
shift init1 by 1 places left.
if cnam2 = '.'.
point = init1+0(2).
exit.
endif.
enddo.
do 2 times.
jpoint = point+0(1).
shift point by 1 places left.
if sy-index = 1.
kpoint = point.
endif.
perform points.
enddo.
cnt1 = strlen( cnam1 ).
do cnt1 times.
cnam2 = cnam1+0(1).
perform calcu .
shift cnam1 by 1 places left.
enddo.
sort itab descending by index.
loop at itab.
if sy-tabix = 1.
jtab-result = itab-result.
jtab-index = itab-index.
append jtab.
else.
if itab-result = 'One ' and ( sy-tabix = 2 or sy-tabix = 5 or
sy-tabix = 7 or sy-tabix = 9 ).
perform teens.
move space to line-result.
modify jtab from line index cnt3 transporting result .
else.
if itab-result <> space.
perform ties.
else.
jtab-result = itab-result.
jtab-index = itab-index.
append jtab.
endif.
endif.
endif.
cnt3 = sy-tabix.
res = itab-result.
endloop.
skip.
loop at jtab.
case sy-tabix.
when 10.
if jtab-result <> space.
if flcr1 = 'X' and flcr2 = 'X'.
concatenate jtab-result 'Hundred Crores' into line-result
separated by ' '.
modify jtab from line index sy-tabix transporting result.
else.
concatenate jtab-result 'Hundred AND' into line-result
separated by ' '.
modify jtab from line index sy-tabix transporting result.
endif.
endif.
when 9.
if flcr1 = 'X'.
if jtab-result <> space.
concatenate jtab-result 'Crores' into line-result
separated by ' '.
modify jtab from line index sy-tabix transporting result.
else.
flcr2 = 'X'.
endif.
endif.
when 8.
if jtab-result <> space.
concatenate jtab-result 'Crores' into line-result
separated by ' '.
modify jtab from line index sy-tabix transporting result.
else.
flcr1 = 'X'.
endif.
when 7.
if flla = 'X'.
if jtab-result <> space.
concatenate jtab-result 'Lacs' into line-result
separated by ' '.
modify jtab from line index sy-tabix transporting result.
endif.
endif.
when 6.
if jtab-result <> space.
concatenate jtab-result 'Lacs' into line-result
separated by ' '.
modify jtab from line index sy-tabix transporting result.
else.
flla = 'X'.
endif.
when 5.
if jtab-result <> space.
if flth = 'X'.
concatenate jtab-result 'Thousand' into line-result
separated by ' '.
modify jtab from line index sy-tabix transporting result.
endif.
endif.
when 4.
if jtab-result <> space.
concatenate jtab-result 'Thousand' into line-result
separated by ' '.
modify jtab from line index sy-tabix transporting result.
else.
flth = 'X'.
endif.
when 3.
if jtab-result <> space.
if flchu1 = 'X' and flchu2 = 'X'.
concatenate jtab-result 'Hundred' into line-result
separated by ' '.
else.
concatenate jtab-result 'Hundred AND' into line-result
separated by ' '.
endif.
modify jtab from line index sy-tabix transporting result.
else.
flhun = 'X'.
endif.
when 2.
if jtab-result = space.
flchu2 = 'X'.
endif.
when 1.
if jtab-result = space.
flchu1 = 'X'.
endif.
endcase.
endloop.
*SORT JTAB ASCENDING BY INDEX.
loop at jtab.
if sy-tabix = 1.
cnam4 = jtab-result.
else.
concatenate jtab-result cnam4 into cnam4 separated by space.
endif.
endloop.
if lpoint2 = space and lpoint1 = space.
lpoint = 'only'.
else.
concatenate 'Paise' lpoint2 lpoint1 'only' into lpoint separated by
space.
endif.
if cnam4 <> space.
shift cnam4 left deleting leading space.
concatenate 'Rupees' cnam4 lpoint into ans separated by space.
*WRITE : / 'RUPEES', CNAM4.
*WRITE : / ANS.
endif.
endform. "COVERSION1
*WRITE : / LPOINT NO-GAP.
form ties.
jtab-index = itab-index.
if sy-tabix = 2 or sy-tabix = 5 or sy-tabix = 7 or sy-tabix = 9.
case itab-result.
when 'Two '.
jtab-result = 'Twenty'.
when 'Three'.
jtab-result = 'Thirty'.
when 'Four '.
jtab-result = 'Fourty'.
when 'Five '.
jtab-result = 'Fifty'.
when 'Six '.
jtab-result = 'Sixty'.
when 'Seven'.
jtab-result = 'Seventy'.
when 'Eight'.
jtab-result = 'Eighty'.
when 'Nine '.
jtab-result = 'Ninety'.
when space.
jtab-result = space.
endcase.
else.
jtab-result = itab-result.
endif.
append jtab.
endform. "TIES
*& Form TEENS
text
form teens.
jtab-index = itab-index.
case res.
when 'One '.
jtab-result = 'Eleven'.
when 'Two '.
jtab-result = 'Twelve'.
when 'Three'.
jtab-result = 'Thirteen'.
when 'Four '.
jtab-result = 'Fourteen'.
when 'Five '.
jtab-result = 'Fifteen'.
when 'Six '.
jtab-result = 'Sixteen'.
when 'Seven'.
jtab-result = 'Seventeen'.
when 'Eight'.
jtab-result = 'Eighteen'.
when 'Nine '.
jtab-result = 'Nineteen'.
when space.
jtab-result = 'Ten'.
endcase.
append jtab.
endform. "TEENS
*& Form CALCU
text
form calcu .
itab-index = sy-index.
case cnam2.
when '1'.
itab-result = 'One'.
when '2'.
itab-result = 'Two'.
when '3'.
itab-result = 'Three'.
when '4'.
itab-result = 'Four'.
when '5'.
itab-result = 'Five'.
when '6'.
itab-result = 'Six'.
when '7'.
itab-result = 'Seven'.
when '8'.
itab-result = 'Eight'.
when '9'.
itab-result = 'Nine'.
when '0'.
itab-result = space.
endcase.
append itab.
endform. "CALCU
*& Form POINTS
text
form points.
if sy-index = 2.
if fpoint = space.
case jpoint.
when '1'.
lpoint1 = 'One'.
when '2'.
lpoint1 = 'Two'.
when '3'.
lpoint1 = 'Three'.
when '4'.
lpoint1 = 'Four'.
when '5'.
lpoint1 = 'Five'.
when '6'.
lpoint1 = 'Six'.
when '7'.
lpoint1 = 'Seven'.
when '8'.
lpoint1 = 'Eight'.
when '9'.
lpoint1 = 'Nine'.
when '0'.
lpoint1 = space.
endcase.
endif.
endif.
if sy-index = 1.
case jpoint.
when '1'.
perform lpointy.
when '2'.
lpoint2 = 'Twenty'.
when '3'.
lpoint2 = 'Thirty'.
when '4'.
lpoint2 = 'Forty'.
when '5'.
lpoint2 = 'Fifty'.
when '6'.
lpoint2 = 'Sixty'.
when '7'.
lpoint2 = 'Seventy'.
when '8'.
lpoint2 = 'Eighty'.
when '9'.
lpoint2 = 'Ninety'.
when '0'.
lpoint2 = space.
endcase.
endif.
endform. "POINTS
*& Form LPOINTY
text
form lpointy.
case kpoint.
when '1'.
lpoint2 = 'Eleven'.
when '2'.
lpoint2 = 'Twelve'.
when '3'.
lpoint2 = 'Thirteen'.
when '4'.
lpoint2 = 'Fourteen'.
when '5'.
lpoint2 = 'Fifteen'.
when '6'.
lpoint2 = 'Sixteen'.
when '7'.
lpoint2 = 'Seventeen'.
when '8'.
lpoint2 = 'Eighteen'.
when '9'.
lpoint2 = 'Nineteen'.
when '0'.
lpoint2 = 'Ten'.
endcase.
lpoint1 = space.
fpoint = 'X'.
endform. "LPOINTY -
Converting USD amount into word
Hi,
I want to convert amount which is in USD into word i am using below FM
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
amount = dmbtr
currency = waers
FILLER = ' '
language = langu
IMPORTING
in_words = spell
EXCEPTIONS
not_found = 1
too_large = 2
OTHERS = 3.
IF sy-subrc = 0.
now my DMBTR amount is 21960.00 which is atually 219.60 USD but in dmbtr initially amount is coming as 21960.00 and when i convert it to word it is coming as USD : TWO HUNDRED NINETEEN, AND CENTS AS SIX THOUSAND, but acutally it should be USD DOLLAR TWO HUNDRED NINETEEN AND CENTS SIXTY ONLY, it is not coming peoprly so is there any other functionn module for this to convert USD , JPY into word.
regards,
zafarHi,
Assign dmbtr to type PAYR_FI-RWBTR.
PARAMETERS: dmbtr type PAYR_FI-RWBTR.
OR
If you didnt get from this try by using type P
PARAMETERS: dmbtr type P.
Regards,
kalandar
Edited by: kalandar on Jun 16, 2010 9:48 AM -
Function Module to convert amount to amount in words
Dear Guru ,
I want to know is there any sap standard Function Module to convert amount value to amount in words
Thanks & RegardsHi..
Use FM SPELL_AMOUNT.
This function module converts an amount or number into words. It can be used as follows:
Convert a number into words
To do this, the transfer parameters LANGUAGE and AMOUNT have to be entered.
Convert an amount into words
To do this, the fields LANGUAGE, CURRENCY, and AMOUNT have to be entered.
Program RF_SPELL contains a sample call of the function module. You can use it for test purposes.
REPORT ZSPELL.
TABLES SPELL.
DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '1234510'.
SY-TITLE = 'SPELLING NUMBER'.
PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
WRITE: 'NUMBERS', T_SPELL-WORD, 'DECIMALS ', T_SPELL-DECWORD.
FORM SPELL_AMOUNT USING PWRBTR PWAERS.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = PAMOUNT
CURRENCY = PWAERS
FILLER = SPACE
LANGUAGE = 'E'
IMPORTING
IN_WORDS = T_SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
ENDFORM. " SPELL_AMOUNT
I hope it helps.
Reward pts if helpful
Regards
- Rishika Bawa -
Function to call to convert amount in words in R12
Hi Experts,
I am creating a custom report that will display invoice details. Included in the fields are AMOUNT and AMOUNT_IN_WORDS. I don't have problem for the AMOUNT field since i can retrieve it directly from the table. My concern is on the AMOUNT_IN_WORDS. Is there any function in EBS R12 which i can call directly in the SQL statement of my report to convert the AMOUNT into Words.
Thanks,
NestorHi mpautom,
What i'm looking for is a built-in function within EBS R12. Because the client doesn't allow creation of function.
Nestor -
HI All,
I need to convert the amount into words in my smartforms.
How is this achieved?
Thanks & Regards,
MurthyHi kan murthy ,
let say in sf the amount is sf_amt...
*Declare varibles in SF like this in global
data: v_word type spell, "structure
v_amt type string.
*Calling Function SPELL_AMOUNT in Program Lines
and Import parameters are V_AMT and Export Parameters are
*V_WORD
call function 'SPELL_AMOUNT'
exporting
amount = v_amt
currency = 'INR'
language = sy-langu
importing
in_words = v_word
exceptions
not_found = 1
too_large = 2
others = 3.
Use V_WORD Where need to print
Regards,
sg -
Amount in words with 'AND' in between.
Hi All,
I have a requiremnt where in i neeed to convert my amount to words and display in SAP script.
I can use the FM SPELL_AMOUNT.This will give the result in words.I need to have the AND in b/w these.
eg:123456789
result:ONE HUNDRED TWENTY-THREE MILLION FOUR HUNDRED FIFTY-SIX THOUSAND SEVEN HUNDRED EIGHTY-NINE.
My requirement:ONE HUNDRED AND TWENTY-THREE MILLION FOUR HUNDRED AND FIFTY-SIX THOUSAND SEVEN HUNDRED AND EIGHTY-NINE.
Any pointers would be appreciated.Hi,
DATA: w_words(200).
After calling FM USe: Concatenate IN_WORDS-WORD 'AND' IN_WORDS-DECWORD into W_WORDS. Now W_Words Will contain the string you required.
Regards
Raju Chitale -
Amount in Words (Indian Rupees)
Dear All,
I am using SAP 2007B PL 18.I have found out the below mentioned function for converting the amount to words in SDN only. But when i try and create the function it gives error "Incorrect Syntax near 00' . I think there is an incomplete syntax near the SubString function. Can someone please help me on the same and give the correct function.
Create function [dbo].[AmountToWords] ( @InNumber Numeric(18,2) )
--Returns the number as words.
returns VARCHAR(2000)
as
BEGIN
SET NoCount ON
Declare @Num Varchar(20)
Declare @Dec Varchar(3)
Declare @Return Varchar(2000)
Set @Dec = SubString(Convert(Varchar(20),@Innumber),Len(Convert(Varchar(20),@Innumber))-2,3)
Set @Num = SubString(Convert(Varchar(20),@Innumber),1, Len(Convert(Varchar(20),@Innumber))-3)
Declare @Hundred Char(8) Declare @HundredAnd Char(12) Declare @Thousand Char(9)
Declare @Lakh Char(5)
Declare @Lakhs Char(6)
Declare @Crore Char(6)
Declare @Crores Char(7)
Set @Hundred = 'Hundred '
Set @Thousand = 'Thousand '
Set @Lakh = 'Lakh '
Set @Lakhs = 'Lakhs '
Set @Crore = 'Crore '
Set @Crores = 'Crores '
Set @HundredAnd = 'Hundred and '
if Len(@Num) = 1
-- One
Begin
Set @Return = dbo.GetTextValue(@Num)
End
Else if Len(@Num) = 2
-- Ten
Begin
Set @Return = dbo.GetTextValue(@Num)
End
Else if Len(@Num) = 3
-- Hundred
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Hundred
IF SubString(@num,2,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2))
End
Else if Len(@Num) = 4
-- thousand
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Thousand
If SubString(@Num,2,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,1)) + @Hundred
IF SubString(@num,3,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2))
End
Else if Len(@Num) = 5
-- Ten Thousand
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,2)) + @Thousand
If SubString(@Num,3,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,1)) + @Hundred
IF SubString(@num,4,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2))
End
Else if Len(@Num) = 6
-- Lakh
Begin
If SubString(@Num,1,1) = '1'
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Lakh
Else
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Lakhs
If SubString(@Num,2,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2)) + @Thousand
If SubString(@Num,4,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,1)) + @Hundred
IF SubString(@num,5,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2))
End
Else if Len(@Num) = 7
-- Ten Lakhs
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,2)) + @Lakhs
If SubString(@Num,3,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2)) + @Thousand
If SubString(@Num,6,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,1)) + @Hundred
IF SubString(@num,6,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2))
End
Else if Len(@Num) = 8
-- Crore
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Crore
If SubString(@Num,2,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2)) + @Lakhs
If SubString(@Num,4,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2)) + @Thousand
If SubString(@Num,6,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,1)) + @Hundred
IF SubString(@num,7,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,2))
End
Else if Len(@Num) = 9
-- Ten Crore
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,2)) + @Crores
If SubString(@Num,3,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2)) + @Lakhs
If SubString(@Num,5,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2)) + @Thousand
If SubString(@Num,7,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,1)) + @Hundred
IF SubString(@num,8,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,2))
End
Else if Len(@Num) = 10
-- Hundred Crore
Begin
Set @Return = dbo.GetTextValue(Substring(@Num,1,1)) + @Hundred
IF Substring(@Num,2,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2))
Set @Return = @Return + @Crores
If SubString(@Num,4,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2)) + @Lakhs
If SubString(@Num,6,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2)) + @Thousand
If SubString(@Num,8,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,1)) + @Hundred
IF SubString(@num,9,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,9,2))
End
Else if Len(@Num) = 11
-- Thousand Crore
Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,1)) + @Thousand
IF SubString(@Num,2,1) '0'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,2,1)) + @Hundred
IF Substring(@Num,3,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2))
Set @Return = @Return + @Crores If SubString(@Num,5,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2)) + @Lakhs
If SubString(@Num,7,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,2)) + @Thousand
If SubString(@Num,9,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,9,1)) + @Hundred
IF SubString(@num,10,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,10,2))
End
Else if Len(@Num) = 12
-- Ten thousand Crore
Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,2)) + @Thousand
IF SubString(@Num,3,1) '0'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,3,1)) + @Hundred
IF Substring(@Num,4,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2))
Set @Return = @Return + @Crores If SubString(@Num,6,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2)) + @Lakhs
If SubString(@Num,8,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,2)) + @Thousand
If SubString(@Num,10,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,10,1)) + @Hundred
IF SubString(@num,11,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,11,2))
End
Else if Len(@Num) = 13
-- Lakh Crore
Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,1)) + @Lakh
If Substring(@Num,2,2) '00'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,2,2)) + @Thousand
IF SubString(@Num,4,1) '0'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,4,1)) + @Hundred
IF Substring(@Num,5,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2))
Set @Return = @Return + @Crores
If SubString(@Num,7,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,2)) + @Lakhs
If SubString(@Num,9,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,9,2)) + @Thousand
If SubString(@Num,11,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,11,1)) + @Hundred
IF SubString(@num,12,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,12,2))
End
Else if Len(@Num) = 14
-- Ten Lakh Crore
Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,2)) + @Lakhs
If Substring(@Num,3,2) '00'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,3,2)) + @Thousand
IF SubString(@Num,5,1) '0'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,5,1)) + @Hundred
IF Substring(@Num,6,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2))
Set @Return = @Return + @Crores If SubString(@Num,8,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,2)) + @Lakhs
If SubString(@Num,10,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,10,2)) + @Thousand
If SubString(@Num,12,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,12,1)) + @Hundred
IF SubString(@num,13,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,13,2))
End
If @Dec '.00'
Set @Return = @Return + 'Rupees And ' + dbo.GetTextValue(SubString(@Dec,2,2)) + 'Paise Only'
ELSE
Set @Return =@Return+'Zero Rupees Only'
Return @return
End
CREATE Function [dbo].[GetTextValue] ( @dblNumber Numeric )
Returns Varchar(1000)
As
Begin
Declare @StrWord Varchar(400)
SET @strWord = Case @dblNumber
When 1 Then 'One '
When 2 Then 'Two '
When 3 Then 'Three '
When 4 Then 'Four '
When 5 Then 'Five '
When 6 Then 'Six '
When 7 Then 'Seven '
When 8 Then 'Eight '
When 9 Then 'Nine '
When 10 Then 'Ten '
When 11 Then 'Eleven '
When 12 Then 'Twelve '
When 13 Then 'Thirteen '
When 14 Then 'Fourteen '
When 15 Then 'Fifteen '
When 16 Then 'Sixteen '
When 17 Then 'Seventeen '
When 18 Then 'Eighteen '
When 19 Then 'Nineteen '
When 20 Then 'Twenty '
When 21 Then 'Twenty One '
When 22 Then 'Twenty Two '
When 23 Then 'Twenty Three '
When 24 Then 'Twenty Four '
When 25 Then 'Twenty Five '
When 26 Then 'Twenty Six '
When 27 Then 'Twenty Seven '
When 28 Then 'Twenty Eight '
When 29 Then 'Twenty Nine '
When 30 Then 'Thirty '
When 31 Then 'Thirty One '
When 32 Then 'Thirty Two '
When 33 Then 'Thirty Three '
When 34 Then 'Thirty Four '
When 35 Then 'Thirty Five '
When 36 Then 'Thirty Six '
When 37 Then 'Thirty Seven '
When 38 Then 'Thirty Eight '
When 39 Then 'Thirty Nine '
When 40 Then 'Fourty '
When 41 Then 'Fourty One '
When 42 Then 'Fourty Two '
When 43 Then 'Fourty Three '
When 44 Then 'Fourty Four '
When 45 Then 'Fourty Five '
When 46 Then 'Fourty Six '
When 47 Then 'Fourty Seven '
When 48 Then 'Fourty Eight '
When 49 Then 'Fourty Nine '
When 50 Then 'Fifty '
When 51 Then 'Fifty One '
When 52 Then 'Fifty Two '
When 53 Then 'Fifty Three '
When 54 Then 'Fifty Four '
When 55 Then 'Fifty Five '
When 56 Then 'Fifty Six '
When 57 Then 'Fifty Seven '
When 58 Then 'Fifty Eight '
When 59 Then 'Fifty Nine '
When 60 Then 'Sixty '
When 61 Then 'Sixty One '
When 62 Then 'Sixty Two '
When 63 Then 'Sixty Three '
When 64 Then 'Sixty Four '
When 65 Then 'Sixty Five '
When 66 Then 'Sixty Six '
When 67 Then 'Sixty Seven '
When 68 Then 'Sixty Eight '
When 69 Then 'Sixty Nine '
When 70 Then 'Seventy '
When 71 Then 'Seventy One '
When 72 Then 'Seventy Two '
When 73 Then 'Seventy Three '
When 74 Then 'Seventy Four '
When 75 Then 'Seventy Five '
When 76 Then 'Seventy Six '
When 77 Then 'Seventy Seven '
When 78 Then 'Seventy Eight '
When 79 Then 'Seventy Nine '
When 80 Then 'Eighty '
When 81 Then 'Eighty One '
When 82 Then 'Eighty Two '
When 83 Then 'Eighty Three '
When 84 Then 'Eighty Four '
When 85 Then 'Eighty Five '
When 86 Then 'Eighty Six '
When 87 Then 'Eighty Seven '
When 88 Then 'Eighty Eight '
When 89 Then 'Eighty Nine '
When 90 Then 'Ninety '
When 91 Then 'Ninety One '
When 92 Then 'Ninety Two '
When 93 Then 'Ninety Three '
When 94 Then 'Ninety Four '
When 95 Then 'Ninety Five '
When 96 Then 'Ninety Six '
When 97 Then 'Ninety Seven '
When 98 Then 'Ninety Eight '
When 99 Then 'Ninety Nine '
When 100 Then 'One hundred '
else ' '
End
Return @strWord
End
Regards,
RahulDear Rahul,
Try this,
->> Create 1 UDF in Header on Requrie Documents (ex. Marketing Documents).
->> Create 3 Function in MSSQL Server Management.
->> Create 1 FMS in Query Generator and save as Query Manager then Assign to UDF for Amount in Words.
for example:
Create UDF in Header on Marketing Documents.
->> Choose Tools on Top menu.
->> User - Defined Fields. -> User Manage Fields.
->> Open the User Manage Fields Widnow.
->> Marketing Documents. -> Title.
->> Select Title and Click Add button in Bottom on User Manage Fields Window.
->> Create Amount in Words UDF(Code, Discription and Type - Character) and Add the UDF.
Create Function in MSSQL Server Management.
Check this Link, (have 3 Functions in Link).
http://techcreeze.blogspot.com/2008/11/convert-amount-into-words-according-to_15.html
1st Funciton - to Convert one Digit Number to words
2nd Funciton - to convert 2 digit number to words.
3rd Funciton - to convert amt in numbers to words.
->> Open the MSSQL Server Management Window.
->> Choose your Company database and Create NEW Query.
->> Create 3 Function Queries one by one.
->> Create 3 NEW Query Tab and 1st one put the 1st Function then Run the Function. and
2nd New Query tab put the 2nd Function then Run the Function.
3rd New Query tab put the 3rd Function then Run the Function.
Create FMS in Query Generator and Save as Query Manager.
->> Adminstration.
->> Reports. -> Query Generator.
->> Open the Query Generator and put the below FMS query.
for example : Purchase Order Doc. Toal(in wrods).
declare @Doc_total numeric (19,6)
set @Doc_total=$[OPOR.DocTotal]
select dbo.fNumToWords (@Doc_total)
->> Assign the FMS in UDF on Purchase Order.
->> Auto Refresh of Document Total.
Ex.
1. Goto the UDF and Clcik ShiftAltF2.
2. Select the SEARCH BY SAVED QUERY.
3. Assign the FMS Query.
4. Select the AUTO REFRESH WHEN FIELD CHENGES.
5. Select Document Total.
6. Check the Display Saved Values. -
Reg: Convert amount in values to amount in words
Dear All,
Want to convert amount value into words and it will displays on UDF which is created in Marketing document. How can i do that.
Plese help me
Thanks & Regards
Venkatesh NHi,
Check Re: Amount in Words in INR for solution.
Create function in SQL and then apply FMS to get that function in udf.
Thanks,
Neetu -
(v urgent) converting amount in figures to amount in words ina spec languag
Hi All,
I have a requirement like i need to convert amount i n figures to amount in words, and that too for a specific language (eg., portuguese and not english) . This needs to be done in the SAPSCRIPT and not in the program as the program is a standard one.
Please help me out as it is v urgent.
Regards,
PriyaUse FM
HR_IN_CHG_INR_WRDS
Award points if answer is useful
tc
saji -
how can i convert amount to words using sql query
eg : Rs 10234.50
Ten Thousand Two Hundred Thirty Four Rupees Fifty PaisePerhaps the forum admin need to put the search box right next to the Create New Message button just so people get the idea that what they're asking for just may have been asked for previously by other people.As when creating a new SR in Metalink: Before posting you'll be asked to to search the bug db, knowledge base, technical forums ...etc ...
Not really a bad idea actually ... -
Any FM to convert amount to words?
Hi friends,
Is there any function module available to convert amount to words?
Regards,
Lijo JosephRefer:
Re: I want Function Name which converts number to words
Regards,
Subramanian V. -
Convert amount to words in Malaysian and Indonesian Language
Hi
I want to convert the number into words , the words should display in Malaysian & Indonesian Language.
I wanted to display in the report
Regards
YramHi,
Incognito wrote:
Hi,
This query will give you the numbers spelled as words.
select to_char(to_date(873,'J'), 'JSP') as converted_form from dual;I am not sure as to how you can change the language through a query. I am afraid, we can not until and unless we change the required NLS parameters.Unfortunately, that returns the number in Engllish, no matter what the NLS settings are.
For other languages, I think a user-defined function is needed.
See AskTom for some ideas. About half way through that long page, there's an example that spells numbers in the German language.
A little bit earlier, there's an example for French, where they actually translate the English words into French. That example may be admired, if not imitated.
Edited by: Frank Kulash on Feb 2, 2010 2:36 PM
Added AskTom reference.
Maybe you are looking for
-
Searching for a genuine fix; last chance before I ...
The Rafiner BT Chronicles ACT I I moved into my house in August 2011. After doing research, I decided to go with BT for phone/broadband as it seemed like the best all around deal for my needs. There are 5 in my family, all on their iphones/ipads/ip
-
Solution import error for on-premise
Hi all, I have a solution in my production environment(divided into 3 parts), when i'm trying to deploy the solution (Managed/Un-managed tried both) onto the client server it is throwing an error without any message (Like a generic message). I have c
-
It just started happening out of the ordinary. I had a photo shoot done today. I came home plugged my camera usb to my mac lap top and tried to import my raw files as i usually do into light room 5 to edit my images. This time the same error message
-
Clearing out cookies...
I use Safari and would like to review my cookies and clear out the redundant one. Is there any way of establishing (maybe at Fnder level or even through some Terminal command) the date a cookie was 'acquired', when it was last used and by which websi
-
Assigning database access using Shared Services
I need to be able to assign security to a specfic database within an application. We have an application that has two databases. I provisioned the necessary group to the correct application to give them access. However, I only want that group to be a