Amount required in Words ?

Hi ,
Experts
For any Transaction/Banking  documents in it's PLDs , there is an requirement of both --
Amount in figure   (Curency - Indian Rupees)
Amount  in words (Curency - Indian Rupees)
*Example Rs- 3450566 /-  so it should be
thirtyfour lacs fifty thousand  five hundred and sixtysix*
I have the problem in getting the Amount in words
Tried the other solutions not able to get it ..

Hi,
Run the below in sql server.
if exists (select * from dbo.sysobjects where id = object_id(N'dbo.AmountToWords') and xtype in (N'FN', N'IF', N'TF'))
drop function dbo.AmountToWords
GO
if exists (select * from dbo.sysobjects where id = object_id(N'dbo.GetTextValue') and xtype in (N'FN', N'IF', N'TF'))
drop function dbo.GetTextValue
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
CREATE function 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'
ELSE
Set @Return =@Return +'Rupees'
Return @return
End
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
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
GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
create UDF on the document where you want the amount in words as per indian format.
run the query generateor,paste the below query...
and save it.
declare @Doc_total numeric (19,6)
set @Doc_total=$[OINV.DocTotal]
select  dbo.AmountToWords (@Doc_total)
now apply formated search on the UDF you created(For e.g. i created on SALes Invoice)
refresh regularly on doctotal.
now choose that UDF on pld.
Hope this will help u.
Regards,
Neetu

Similar Messages

  • Amount total(In Words) in Indian Format.

    Hi All,
    I want to have the amount total of marketing documents in words in Indian format.
    Problem description :
    If the the amount total is 565136.
    Right Now in Print Layout Design its showing : Five hundred and sixty five thousand one hundred and thirty six.
    I want the same in Indian format, that is :
    It should print as : Five lakhs sixty five thousand one hundred and thirty six.
    Please help me.
    Thanks & Regards,
    Saikat Roy

    Hi!
    CREATE    Function dbo.fConvertDigit(@decNumber decimal)
    returns varchar(6)
    as
    Begin
    declare
    @strWords varchar(6)
    Select @strWords = Case @decNumber
         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'
         Else ''
    end
    return @strWords
    end
    CREATE    Function dbo.fConvertTens(@decNumber varchar(2))
    returns varchar(30)
    as
    Begin
    declare @strWords varchar(30)
    --Is value between 10 and 19?
    If Left(@decNumber, 1) = 1
    begin
    Select @strWords = Case @decNumber
         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'
    end
    end
    else  -- otherwise it's between 20 and 99.
    begin
    Select @strWords = Case Left(@decNumber, 1)
         When '0' then '' 
         When '2' then 'Twenty '
         When '3' then 'Thirty '
         When '4' then 'Forty '
         When '5' then 'Fifty '
         When '6' then 'Sixty '
         When '7' then 'Seventy '
         When '8' then 'Eighty '
         When '9' then 'Ninety '
    end
    Select @strWords = @strWords + dbo.fConvertDigit(Right(@decNumber, 1))
    end
    --Convert ones place digit.
    return @strWords
    end
    CREATE function dbo.fNumToWords (@decNumber decimal(12, 2))
    returns varchar(300)
    As
    Begin
    Declare
    @strNumber varchar(100),
    @strRupees varchar(200),
    @strPaise varchar(100),
    @strWords varchar(300),
    @intIndex integer,
    @intAndFlag integer
    Select @strNumber = Cast(@decNumber as varchar(100))
    Select @intIndex = CharIndex('.', @strNumber)
    if(@decNumber>99999999.99)
    BEGIN
    RETURN ''
    END
    If @intIndex > 0
    begin
    Select @strPaise = dbo.fConvertTens(Right(@strNumber, Len(@strNumber) - @intIndex))
    Select @strNumber = SubString(@strNumber, 1, Len(@strNumber) - 3)
    If Len(@strPaise) > 0 Select @strPaise = @strPaise + ' paise'
    end
    Select @strRupees = ''
    Select @intIndex=len(@strNumber)
    Select @intAndFlag=2
    while(@intIndex>0)
    begin
    if(@intIndex=8)
    begin
      Select @[email protected](left(@decNumber,1))' Crore '
      Select @strNumber=substring(@strNumber,2,len(@strNumber))
      Select @intIndex=@intIndex-1
    end
    else if(@intIndex=7)
    begin
      if(substring(@strNumber,1,1)='0')
      begin
       if substring(@strNumber,2,1)<>'0'
       begin
        if (@strRupees<>NULL and substring(@strNumber,3,1)='0' and substring(@strNumber,4,1)='0' and substring(@strNumber,5,1)='0' and substring(@strNumber,6,1)='0' and substring(@strNumber,7,1)='0' and @intAndFlag=2 and @strPaise=NULL)
        begin
         Select @strRupees=@strRupees+' and ' dbo.fConvertDigit(substring(@strNumber,2,1))' Lakh '
         Select @intAndFlag=1
        end
        else
        begin
         Select @[email protected](substring(@strNumber,2,1))' Lakh '
        end
        Select @strNumber=substring(@strNumber,3,len(@strNumber))
        Select @intIndex=@intIndex-2
       end
       else
       begin
        Select @strNumber=substring(@strNumber,3,len(@strNumber))
        Select @intIndex=@intIndex-2
       end
      end
      else
      begin
       if(substring(@strNumber,3,1)='0' and substring(@strNumber,4,1)='0' and substring(@strNumber,5,1)='0' and substring(@strNumber,6,1)='0' and substring(@strNumber,7,1)='0'  and @intAndFlag=2 and @strPaise='')
       begin  
        Select @strRupees=@strRupees+' and ' + dbo.fConvertTens(substring(@strNumber,1,2))+' Lakhs '
        Select @intAndFlag=1
       end
       else
       begin
        Select @[email protected](substring(@strNumber,1,2))' Lakhs '
       end
       Select @strNumber=substring(@strNumber,3,len(@strNumber))
       Select @intIndex=@intIndex-2
      end
    end
    else if(@intIndex=6)
      begin
       if(substring(@strNumber,2,1)<>'0' or substring(@strNumber,3,1)<>'0' and substring(@strNumber,4,1)='0' and substring(@strNumber,5,1)='0' and substring(@strNumber,6,1)='0' and @intAndFlag=2 and @strPaise='')
       begin
        if len(@strRupees) <= 0
        begin
         if convert(int,substring(@strNumber,1,1)) = 1
         begin
          Select @strRupees=@strRupees+'' + dbo.fConvertDigit(substring(@strNumber,1,1))+' Lakh '
          Select @intAndFlag=2
         end
         else
         begin
          Select @strRupees=@strRupees+'' + dbo.fConvertDigit(substring(@strNumber,1,1))+' Lakhs '
          Select @intAndFlag=2
         end
        end
        else
        begin
         if convert(int,substring(@strNumber,1,1)) = 1
         begin
          Select @strRupees=@strRupees+' and' + dbo.fConvertDigit(substring(@strNumber,1,1))+' Lakh '
          Select @intAndFlag=1
         end
         else
         begin
          Select @strRupees=@strRupees+' and' + dbo.fConvertDigit(substring(@strNumber,1,1))+' Lakhs '
          Select @intAndFlag=1
         end
        end
       end
       else
       begin
        if convert(int,substring(@strNumber,1,1)) = 1
        begin
         Select @[email protected](substring(@strNumber,1,1))' Lakh '
        end
        else
        begin
         Select @[email protected](substring(@strNumber,1,1))' Lakhs '
        end
       end
       Select @strNumber=substring(@strNumber,2,len(@strNumber))
       Select @intIndex=@intIndex-1
      end
    else if(@intIndex=5)
      begin
       if(substring(@strNumber,1,1)='0')
       begin
        if substring(@strNumber,2,1)<>'0'
        begin
         if(substring(@strNumber,3,1)='0' and substring(@strNumber,4,1)='0' and substring(@strNumber,5,1)='0' and @intAndFlag=2 and @strPaise='')
         begin
          Select @strRupees=@strRupees+' and ' dbo.fConvertDigit(substring(@strNumber,2,1))' Thousand '
          Select @intAndFlag=1
         end
         else
         begin
          Select @[email protected](substring(@strNumber,2,1))' Thousand '
         end
         Select @strNumber=substring(@strNumber,3,len(@strNumber))
         Select @intIndex=@intIndex-2
        end
        else
        begin
         Select @strNumber=substring(@strNumber,3,len(@strNumber))
         Select @intIndex=@intIndex-2
        end
       end
       else
       begin
        if(substring(@strNumber,3,1)='0' and substring(@strNumber,4,1)='0' and substring(@strNumber,5,1)='0' and @intAndFlag=2 and @strPaise='')
        begin
         Select @strRupees=@strRupees' and 'dbo.fConvertTens(substring(@strNumber,1,2))+' Thousand '
         Select @intAndFlag=1
        end
        else
        begin
         Select @[email protected](substring(@strNumber,1,2))' Thousand '
        end
        Select @strNumber=substring(@strNumber,3,len(@strNumber))
        Select @intIndex=@intIndex-2
       end
      end
    else if(@intIndex=4)
      begin
       if ( (substring(@strNumber,3,1)<>'0' or substring(@strNumber,4,1)<>'0') and substring(@strNumber,2,1)='0' and  @intAndFlag=2 and @strPaise='')
       begin
        Select @strRupees=@strRupees+' and' + dbo.fConvertDigit(substring(@strNumber,1,1))+' Thousand '
        Select @intAndFlag=1
       end
       else
       begin
       Select @[email protected](substring(@strNumber,1,1))' Thousand '
       end
       Select @strNumber=substring(@strNumber,2,len(@strNumber))
       Select @intIndex=@intIndex-1
      end
    else if(@intIndex=3)
      begin
       if  substring(@strNumber,1,1)<>'0'
       begin
        Select @[email protected](substring(@strNumber,1,1))' Hundred '
        Select @strNumber=substring(@strNumber,2,len(@strNumber))
        if( (substring(@strNumber,1,1)<>'0' or  substring(@strNumber,2,1)<>'0') and @intAndFlag=2 )
        begin
         Select @strRupees=@strRupees+' and '
         Select @intAndFlag=1
        end
        Select @intIndex=@intIndex-1
       end
       else
       begin
        Select @strNumber=substring(@strNumber,2,len(@strNumber))
        Select @intIndex=@intIndex-1
       end
      end
    else if(@intIndex=2)
      begin
       if substring(@strNumber,1,1)<>'0'
       begin
        Select @strRupees=@strRupees+dbo.fConvertTens(substring(@strNumber,1,2))
        Select @intIndex=@intIndex-2
       end
       else
       begin
        Select @intIndex=@intIndex-1
       end
      end
    else if(@intIndex=1)
      begin
       if(@strNumber<>'0')
       begin
        Select @strRupees=@strRupees+dbo.fConvertDigit(@strNumber)
       end
       Select @intIndex=@intIndex-1
      end
    continue
    end
    if len(@strRupees)>0 Select @strRupees=@strRupees+ ' rupees '
    IF(len(@strPaise)<>0)
    BEGIN
    if len(@strRupees)>0 Select @strRupees=@strRupees + ' and '
    END
    Select @strWords = IsNull(@strRupees, '') + IsNull(@strPaise, '')
    select @strWords = @strWords + ' only'
    Return @strWords
    End
    ==============================
    Declare @str varchar(500)
    Declare @no numeric(19,6)
    Set @no=12453456.45
    Set @str =dbo.fNumToWords (@no)
    Select @str
    ===============================

  • Convert amount to in words

    Hi all ,
    i wanr to convert amount(which in numeric )   into words
    ex   1234 i want one thousand two hundared thirty four
    plz tell me function will help me or other solution
    Regards
    Bhavesh

    hie
    check the following code.
      x_amount = z_payslip01-amount.
      CALL FUNCTION 'SPELL_AMOUNT'
        EXPORTING
          amount    = x_amount
          currency  = 'ZWS'
        IMPORTING
          in_words  = xwords
        EXCEPTIONS
          not_found = 1
          too_large = 2
          OTHERS    = 3.
      IF sy-subrc <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
      ENDIF.
      CONCATENATE xwords-word 'Kerd' xwords-decword 'Cents'
      INTO z_payslip01-amount_in_words SEPARATED BY space.
    regards
    Prince Isaac

  • Regarding Amount(Dollars) into Words

    hi all,
          How we will convert Amount( in terms of Dollars) into Words . I know how to convert Amount (in Rupees) into Words
    and I know function module SPELL_AMOUNT . but it is not working for Decimals.
    Can anyone suggest solution for this.
    Regards
    Rami Reddy

    https://www.sdn.sap.com/irj/sdn/wiki?path=/display/snippets/spell%2bthe%2bamount%2bentered%2bin%2bwords
    Split the amout into two, Dollar and Cents
    123. 45
    call FM for 123 and call FM for 45 and concatenate the result.
    Youcall the Same function module, twice, once for dollars and once for cents, and concatenate the both answers.

  • Does RH11 have a maximum limit on the amount of index words added to a topic?

    I have received a request to add over 50 index words to a topic. I don't find it resonable but it is a client request. RH11 WebHelp

    Hi there
    To my knowledge there is no limit. Actually, index words are a good thing. They allow users to find topics more easily!
    Cheers... Rick

  • Require MS WORD API for Java

    I am looking for a way to access only the attributes of a Word document. I don't need to access the document content, no reading or writing. Just read the attributes. Is there an API out there for this?
    I've heard you can do this using a com-bridge, but I have no experience with this - is it easily done and should I venture it - is it worth the effort and can it actually done what I need?
    I've heard from someone about a JWord interface, but couldn't find any info on it.
    Thanks.

    you could use a combination of a word macro and the ActiveX bridge. the activex bridge is for accessing java and the macro for reading the attributes and pass it over the activx bridge to java. btw: the activex bridge is removed in the latest J2SE.

  • Reg: Conversion from 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 N

    Hi Venkatesh,
    You need to write a UDF to achieve the requirement.
    Check the below link, this will help you to code:
    http://www.java-samples.com/showtutorial.php?tutorialid=1156
    Thanks,

  • Crystal Report-Amount in Words Need correction and Delivery date.

    Dear Experts,
    Issue 1
                            In crystal reports i'm converting Amount in to words using the following formula. In that i am getting Every thing in Uppercase with - i.e. RUPEES ONE THOUSAND-FIVE HUNDRED AND .
    I need in Sentence case i.e all First Letters in Capital and also want to Remove '-'
    Amount in Word
    numbervar RmVal:=0;
    numbervar Amt:=0;
    numbervar pAmt:=0;
    stringvar InWords :="Rupees ";
    Amt := {OPOR.DocTotal};
    if Amt > 10000000 then RmVal := truncate(Amt/10000000);
    if Amt = 10000000 then RmVal := 1;
    if RmVal = 1 then
    InWords := InWords + " " + towords(RmVal,0) + " crore"
    else
            if RmVal > 1 then InWords := InWords + " " + towords(RmVal,0) + " crores";
        Amt := Amt - Rmval * 10000000;
        if Amt > 100000 then RmVal := truncate(Amt/100000);
        if Amt = 100000 then RmVal := 1;
        if RmVal = 1 then
            InWords := InWords + " " + towords(RmVal,0) + " lakhs"
        Else
            If RmVal > 1 then InWords := InWords + " " + ToWords(RmVal,0) + "Lakhs";
            Amt := Amt - Rmval * 100000;
            if Amt > 0 then InWords := InWords + " " + towords(truncate(Amt),0);
            pAmt := (Amt - truncate(Amt)) * 100;
            if pAmt > 0 then
                InWords := InWords + " and " + towords(pAmt,0) + " paisa only"
            else
                InWords := InWords + " only";
            UPPERCASE(InWords)
    Issue 2.
    At Delivery terms I'm using the following formula to display the delivery data. If the document date and due date is same it will print Delivery Immediate otherwise it should calculate the Delivery date from document date, but now it's printing DocDue date.
    I need to calculate Delivery Date = DocDuedate - DocDate. 
    If {OPOR.DocDate} = {OPOR.DocDueDate} Then
        "2. Delivery immediate"
    Else
        "2. Delivery on or before " &  {OPOR.DocDueDate}
    Thanks
    Kamal

    Hi
    Try this formula
    numbervar RmVal:=0;
    numbervar Amt:=0;
    numbervar pAmt:=0;
    stringvar InWords :="Rupees ";
    Amt := {@GrandTotal} ;
    if Amt > 10000000 then RmVal := truncate(Amt/10000000);
    if Amt = 10000000 then RmVal := 1;
       if RmVal = 1 then
            InWords := InWords + " " + ProperCase (towords(RmVal,0)) + " crore"
       else
            if RmVal > 1 then InWords := InWords + " " + ProperCase (towords(RmVal,0)) + " crores";
        Amt := Amt - Rmval * 10000000;
        if Amt > 100000 then RmVal := truncate(Amt/100000);
        if Amt = 100000 then RmVal := 1;
        if RmVal = 1 then
            InWords := InWords + " " + ProperCase (towords(RmVal,0)) + " lakhs"
        Else
            If RmVal > 1 then InWords := InWords + " " + ProperCase (ToWords(RmVal,0)) + " Lakhs";
            Amt := Amt - Rmval * 100000;
            if Amt > 0 then InWords := InWords + " " + ProperCase (towords(truncate(Amt),0));
            pAmt := (Amt - truncate(Amt)) * 100;
            if pAmt > 0 then
                InWords := InWords + " and " + ProperCase (towords(pAmt,0)) + " paise only"
            else
                InWords := InWords + " only";
            ProperCase(InWords)
    Regards
    Vivek

  • 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 N

    Hi,
    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

  • SAP Script : Amount in Words

    Dear All,
    I am working on bank Check, I need to print the amount value in Words. Amount field  &REGUD-SWNES&, I need to print this amount in words.
    I mean to say that, regud-swnes = 1000.69, I have to print this as One Thousand and 69/100. please advice me, how Can I do that.
    Thanking you.
    with kind Regards
    Venkat.

    hi venkat,
    split the command at decimal and u can design ur code for 69/1000.for displaying 1000 u can use the fm 'SPELL_AMOUNT'.
    sample:
    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.              
    reward if helpful.
    regards,
    keerthi.

  • SAP Output as MS word doc.

    My requirement is to get the output as a MS word format ..
    without using any third party toool? Can we really achieve it or not ?
    What we propsed is a solution is to get the output to a PDF file then to use
    the PDF to word converter  which cost them some amount but they were not satisfied to that .
    they need the output directly from SAP .
    Can we do this in SAP or not ?

    >> NO experts are replying for this Question ....
    Hm... I don't think you will get very far with comments like this
    But anyway...
    I don't think there is a way to convert any output to MS Word format natively using only ABAP. It is possible using OLE but that requires MS Word to be installed on the workstation, plus due to OLE, this doesn't work in programs running in the background.
    The situation is similar to generating an Excel spreadsheet (and now I'm not talking about DAT and tab delimited format but real native Excel output). It is also not possible without involving OLE or some other third party tool as far as I'm aware.
    I'm sure there is a reason for this - probably related to licensing or something like that.
    It'd be certainly nice to have a way to create .DOC or .XLS files natively from ABAP... just nobody developed it yet

  • How To Print the contents of a BLOB Column on a report?(Word Document)

    Requirement: The word document will be inserted in a BLOB Column and the data in the word document has to be shown on the reports or the user should be able to see the word document (atleast he should be able to view the contents)?
    The data is getting loaded in the database but not sure how to proceed further.
    Any inputs on how to proceed will be appreciated.
    Thanks.

    in JComponent there is a method called print(Graphics g)
    you can use that with a Printable class
    read bout the java.print package in the java doc

  • Can someone please tell me what the app is called for Microsoft Word?

    I can only find MS Templates, but it requires MS Word to run so I'm confused?

    You have to get Word from Microsoft - for a free 30-day trial, see here.
    The Word templates you have may be able to be opened by Pages - from the App Store. Much less expensive than the Office suite. Even less expensive (as in free) is LibreOffice - which will open Word files and save in Word format.
    Good luck,
    Clinton

  • Custom Spell Check from ABAP Code without MS Word

    Hi All,
    I am working on a requirement where we need to check for misspelt words in a string that is received from another system. I have come across a number of FM's which can be used to check for spellings but all of the require MS Word to be installed in our PC, but I am looking for a solution that does not involve MS Word. If any of you have come across any external tool that can be called from ABAP code or any suggestion on a logic that can be built please pass it on. Any pointers or help in this regard would be highly appreciated.
    Thanks,
    Praveen

    Hi,
    Try the "CF_WWSpeller" customtag which actually uses the
    Winword spelling engine,
    http://web4w3.com/wwspeller.html

  • MS Word print

    Hi.
    I need a source code that prints MS Word document across Java.
    I anyone has such code please send to my e-mail:
    [email protected]
    I am desperated....
    Thank you.
    Charles

    Hi.
    I need a source code that prints MS Word document
    across Java.To print in Java would be hard, you could try POI, but as I understand it, this is an editing API, not displaying. You could use JDIC's Desktop.print, but that would require a Word-compable application to be installed.
    I anyone has such code please send to my e-mail:
    [email protected]
    I am desperated....I guess you will be inundated with "offers" soon.

Maybe you are looking for

  • Data Recovery AFTER TechTool Deluxe "Repair" ?

    Hello, I have a PB from Fall 2005 (1.5 Ghz, 512 Ram, superdrive, 80 GB) running 10.4. Recently, performance really started to lag, so I began diligent monitoring and ordered an external HD to perform a more comprehensive backup. For the last week, al

  • Can I install windows on my early 2008 iMac?

    I really want to get a software called Training Peaks running on my early 2008 iMac, but it appears that I can no longer get a version of Windows which is compatible. Is this correct? Is there a way around the problem?

  • Adobe Form Fields to database (either Excel or Access)

    i have a pdf form created from adobe acrobat XI pro that works perfectly.  When submitted, it emails directly to me, which I manually add to a database file stored in Excel.  I'm trying to find a simple way to have the data automatically added to an

  • * Urgent FND_REQUEST.SUBMIT_REQUEST *

    Hi Gurus, I am having a problem in Oracle apps. I am calling the following function and running a shell script which has been registered in apps as "CPSINTA" and working fine if I run it using concorrent program. I need to run this from forms and I w

  • Creative Ultra for Notebook, white balance not working??

    After years of use with my Creative Notebook Cam Pro I decided to upgrade and get the Ultra for Notebook because it's a CCD and works better in lower light conditions. The drivers install fine however I cannot adjust the white balance nothing changes