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
===============================

Similar Messages

  • Amount in words in indian format

    Dear All,
    I have refer this link to get amount in words in indian format.but it is showing me error.what i copied in sql is -
    *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*
    but it showed me error.Let me know where i am getting wrong.
    I also  created 1 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
    Regards-
    Mona.

    Dear,,
    Run the below functions in your database:
                                                                                    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
    CREATEFunction [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
    Run the query generator of SAP,paste below query.
    Apply FMS on field.
    declare @Doc_total numeric (19,6)
    set @Doc_total=$[OINV.DocTotal]
    select  dbo.AmountToWords (@Doc_total)

  • Amount in words in F110 (sapscript -indian format)

    Hi Experts.
    I have changed the F110_PRENUM_CHCK to Z110_PRENUM_CHCK .
    I want the amount to be in word in indian format.
    say Ten Lakh ninty thousand and fifty
    But i am getting the output in "One millon .. " format
    Pls give me the coding and also suggest me how to incorporate in sapscript .
    Window CHECKSPL
    545
    Amount in words -
    &'*** 'SPELL-WORD& &' and 'SPELL-DECWORD&***
    Example for amount and decimal places in words
    &'*** 'SPELL-WORD& &REGUD-WAERS&&' and 'SPELL-DECWORD' Cents'& ***
    Example for numbers in words
    &SPELL-DIG06(6)&&SPELL-DIG05(6)&&SPELL-DIG04(6)&&SPELL-DIG03(6)&&SPELL-DIG02(6)&&SPELL-DIG01(7)&
    Pls revert back its urgent
    Thanks
    Pravesh Deshbhratar

    same code i used in smartform:
    DATA : l_spell_a TYPE pc207-betrg,
    l_local   TYPE string,
    w_len     TYPE i.
    * Internal Table Declaration
    DATA : BEGIN OF t_char OCCURS 0,
    char(80) TYPE c,
    END OF t_char.
    l_spell_a = l_amtsum.
    CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
    EXPORTING
    amt_in_num         = l_spell_a
    IMPORTING
    amt_in_words       = l_spell
    EXCEPTIONS
    data_type_mismatch = 1
    OTHERS             = 2.
    IF sy-subrc = 0.

  • Amounts In Indian Formats

    Hi Gurus,
    I have Designed Some PLD's  and my clients wish to print the amount in words in indian format,
    Like if it is 125000 means it needs  to be printed like  One Lakh Twenty Five Thousands Rupees   but instead of that it is printing like one hundred and twenty five thousands.
    I need wo print in  Indian format.
    So Pls guide me in finding a  proper solution for this issue.
    Thanx in Advance.
    Regards,
    Vamsi

    Hi Parimis,
    If you need to Print a INDIAN STYLE Amount in Words.
    Try this,
    ->> Create 1 UDF in Header on Require Documents (ex. Marketing Documents).
    ->> Create 3 Function in MS SQL 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 Window.
    ->> Marketing Documents. -> Title.
    ->> Select Title and Click Add button in Bottom on User Manage Fields Window.
    ->> Create Amount in Words UDF(Code, Description and Type - Character) and Add the UDF.
    Create Function in MS SQL 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 Function - to Convert one Digit Number to words
    2nd Function - to convert 2 digit number to words.
    3rd Function - to convert amt in numbers to words.
    ->> Open the MS SQL 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.
    ->> Administration.
    ->> Reports. -> Query Generator.
    ->> Open the Query Generator and put the below FMS query.
    for example : Purchase Order Doc. Total (IN WORDS).
    DECLARE @Doc_total numeric (19,6)
    SET @Doc_total=$[OPOR.DocTotal]
    SELECT  dbo.fNumToWords(@Doc_total)
    OR
    Try this Simple FMS
    SELECT dbo.fNumToWords($[OPOR.DocTotal])
    ->> 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 CHANGES.
    5. Select Document Total.
    6. Check the Display Saved Values.
    CLOSE THE THREAD, IF ISSUE SOLVED
    Regards,
    Madhan.

  • How to convert standard (Western) numerical format to Indian format?

    I have been doing a lot of research and while I've repeatedly found the function module to convert numerical amounts in to words (HR_IN_CHG_INR_WRDS) I haven't found a way to convert a standard numerical format, 121,212,123 in to the Indian format of 12,12,12,123 or 505,000 to 5,05,000 for example.
    I repeatedly saw in other threads people were suggesting to change the decimal format of the currency in OY01 however the Indian format option is not listed.  We only have the following options:
    X 1,234,567.89
    Y 1 234 567,89
        1.234.567,89
    Whereas I would need 12,34,567.89.
    Is there a Function Module we can use? Is there some CIN add-on we need to import to make the additonal decimal format available?
    Thanks in advance

    Check [this link>>>|http://www.xe.com/ucc/convert.cgi?Amount=10000000&From=USD&To=INR&image.x=62&image.y=20&image=Submit]
    else.. You might have to write a conversion routine...
    DATA: curr TYPE netwr,
          c(20) TYPE c.
    curr = '1234567890'.
    WRITE:/ 'before:', curr.
    WRITE curr TO c USING EDIT MASK '__,__,___.__'.
    WRITE:/ 'after:', c.

  • 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

  • Trouble trying to get correct AP Check Amount total on a report

    Okay, the challenge is to try and explain my situation well. I am in Discoverer Plus. I am working to develop a Discoverer report that will show, for accounts payable application, a summary report by bank name and job number, a check count, invoice count, and check amount total. For simplicity sake, since I have the problem once I go past one table, I am dealilng with tables ap_checks_all and ap_invoice_payments_all from EBS, the tables joined on check id. Now, if I work just with the ap_checks_all table, I can easily get the correct sum of check amounts (column name in the table is AMOUNT). However when I bring in the invoice payments table, then I run into trouble. I first did the SUM data point for AMOUNT, and got a number that was way too high. Figured out that is because anytime I have multiple invoices on a check (which is most of the time), the check amount gets added in for each invoice. So if check amount is $100.00 and the check pays 5 invoices, $500.00 is added to the total amount, instead of the just the $100.00.
    So I tried the SUM_DISTINCT function next - SUM_DISTINCT(AMOUNT). Got me a lot closer, but now my total was too low. Figured out that was because if I had separate checks with the same check amount, that check amount only gets added in one time. Say Check 18 is for $100.00 and Check 39 is for $100.00, I only get $100.00 into the total instead of $200.00. Which when you think about it, is exactly what the SUM_DISTINCT function means. Since the chances of check amounts being duplicated are low, that is why I get close to the right number, but when dealing with tens of thousands of checks, check amount duplication does happen.
    So on my totals for the SUM_DISTINCT column, I finally figured out that a CELL SUM got me closer to the right number. I only had a problem now when, on the same bank name and job number, would still have duplicate check amounts at that key (group by) status level. Percentage wise, my error is low - off maybe $200,000 out of $180,000,000. So close to the right number, yet so far.
    The same thing happens in raw SQL. If you think about the raw join result, you can see what is happening -
    check 1, check 1 amount, invoice 1
    check 1, check 1 amount, invoice 2
    check 2, check 2 amount, invoice 3
    check 3, check 3 amount, invoice 4
    So if you do SUM(CHECK AMOUNT), well yeah, it will add in the check 1 amount twice.
    If you do SUM_DISTINCT(CHECK AMOUNT), then check 1 amount only gets counted once. Great. Ahh, but what if check 3 amount = check 1 amount? Oops, the check 3 amount is excluded.
    Does anyone know of a way to get around this problem? I have been playing around with the functions, but the SQL reference does not give many examples to help understand all the various optional parameters. I know, in vague concept, what I want. Something like -
    SUM(AMOUNT) DISTINCT ON CHECK_ID, or
    SUM_DISTINCT(AMOUNT) DISTINCT ON CHECK_ID.
    CHECK_ID is the internal Oracle id number for each check, from the ap_checks_all table. Check number is not unique enough, since different bank accounts may be using the same check number in the same time period. So I want a way to be able to add my check amount to the total one time when there are multiple invoices on the check, and then get each invidual check amount (one time) added up to get my check total amount.
    Like I said, no problems with Discoverer or raw SQL if doing just one table. But once I join checks to invoice payments, poof, I run into trouble.
    I did not think I was trying to do anything unusual. So quite surprising that having so much trouble trying to find a way around this problem.
    Hope this detail explanation makes some sense. Thanks for any help/insight anyone can give me.
    John Dickey

    Michael,
    Nope, that does not work. It truly just gives me an average. My desired (table) report row format is this -
    Bank name , Job Number, Check Count , Invoice Count , Check Amount Total
    So this is a SUMMARY report. Not a detail report. If I do detail, I do not have any problems - I get my correct check amount total. If I do just the ap_checks_all table, I get the correct amount (but then cannot get my invoice count). I get the correct check count (count distinct on check id). I get the correct invoice count. When I added a calculation column using the Average function as you suggested, I see on each row what is likely the average check amount. Which is exactly what you would expect to see.
    Now I did get a brainstorm and tried this. I calculated both the average and average distinct on check amount, then multiplied each by my check count. Darn. Still does not work. The Average Distinct * Check Count = SUM_DISTINCT(CHECK AMOUNT), which I already have. Average Distinct apparently only includes a duplicate check amount one time in calculating the average (which when you think about it, makes sense, darn it). The AVERAGE function still has the problem, it looks like, of including the check amount each time on checks with multiple invoices (and thus multiple rows in the join result) in determining the average. Which when you think about the raw join result from joining checks to invoice payments tables, makes sense. The result of AVERAGE * CHECK COUNT is better than the SUM(AMOUNT) column, but not as good as the SUM_DISTINCT(AMOUNT) column.
    Any other ideas? Interesting that something that seems like a pretty basic thing to do, if it does have a solution, is not a very obvious/simple solution.
    John Dickey

  • Indesign CS6 Total Document Word Count... No?

    I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:
    What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?
    I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??
    Pardon my exasperation in the above comment, but....Seriously?  
    I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.
    Thank you.
    - Exasperated Journalist Slag

    Yes, there are ways, just not what you expected.
    One approach to counting words in multiple text frames in InDesign is to thread them together. To maintain the pieces of text in their assigned threaded text frames, you can create a paragraph style that starts in the next frame, and assign it to the first paragraph in each text frame. Or, you can break the threads when the count is stable.
    If the text frames need to adjust their size to the amount of their content, search Google for terms like "indesign auto resize text frame" without quotes for details.
    There was a recent discussion about auto-resizing text frames that mentioned the free AutoFit InDesign plug-in, from typefi.com. Search Google for terms like "indesign typefi autofit" for details.
    Search Google for terms like "threading and unthreading InDesign text frames" without quotes, for details.
    Search Google for terms like "indesign start paragraph in next frame" without quotes, for details.
    You can file a formal feature improvement request here: Wishform.
    HTH
    Regards,
    Peter
    Peter Gold
    KnowHow ProServices
    evanexempt wrote:
    I left the following comment on a Youtube tutorial explaining how to execute a word count query for an Indesign document ASSUMING your article layout uses a single box of text:
    What if an article uses a creative layout with multiple text-boxes? Are you supposed to get out your pocket calculator and add them up one-by-one?
    I work for a magazine that publishes short, submission-style testimonials bridged together with staff-generated narrative copy; some of our articles use six or more discreet text-boxes. You REALLY MEAN TO TELL ME that there is NO WAY to yield a TOTAL DOCUMENT WORD COUNT using what is SUPPOSED TO BE the MOST ADVANCED page layout application ON EARTH??
    Pardon my exasperation in the above comment, but....Seriously?  
    I need someone knowledgeable to please look me in the eyes and tell me, "This is true", before I am going to be able to let myself believe it.
    Thank you.
    - Exasperated Journalist Slag

  • I want to display totals in words

    Hi Friends,
    I want to display sub-totals/totals in words also. If the total is 1,20,500, I want to display it one lakh twenty thousands five hundred.
    If I created a report, I want to display the total no.of pages at in the end-of-page event.
    ---End of page, page No: 1 of 15. like this.
    Plz help me, I need this very soon.

    Assuming that you want to display pages in the format '<current Page> of <total pages>' I would suggest you construct your code something this:
    1) In your TOP-OF-PAGE, display the current page normally during every new page using the variable SY-PAGNO.
      Eg.  WRITE AT: 120(003) SY-PAGNO,
                     125(2)   'of'.
    2) Then finally capture SY-PAGNO to a variable, say TOTPAGE = SY-PAGNO. (Or have a counter that increment everytime a TOP-OF-PAGE is encountered).
    3) After all the pages are populated, the variable mentioned in the above step will have the total pages.
    4) In your END-OF-SELECTION, use the following code after all the report generating stmts like 'WRITE', 'SKIP' are used:
    DO TOTPAG TIMES.
    <X> denotes the line in which your '<SY-PAGNO> of <TOTPAGE>' appear
       READ LINE <X> OF PAGE SY-INDEX LINE VALUE INTO G_LINE.
    Now move the total pages into the appropriate columns of the line (in our case it may be 128(5) - assuming 5 digit value for max pages) 
        G_LINE+128(5) = TOTPAG.
        MODIFY LINE <X> OF PAGE SY-INDEX LINE VALUE FROM G_LINE.
      ENDDO.
    This modifies the total page value in all the pages displayed.
    Regards,
    Vijay

  • How to display currency values in indian format

    hi all,
       When I am displaying Currency values as output , those are displaying in U.S. format (ie.1,234,000.00) , But I need to display those in Indian Rupee format (i.e 12,34,000.00).
    Plz any one can help me that how to display this
    thank you,
    regards
    Hanuma

    Hi Hanuma kumar, please try this code.
    REPORT ZAMOUNT_CONVERSION.
    DATA : RESULT1(20).
    PARAMETERS : NUM TYPE P DECIMALS 2.
    DATA : num2 type STRING.
    DATA :  col_amt(20) type n,"15
             col_b type i,
             num_1(20) type C,"15
             Length type i.
    num_1 = num.
    write : 'default format      :',num.
    uline.
    skip.
    IF ( num >= 999999999 ).
           write num_1 using edit mask 'RR__,__,__,__,______' to col_amt.
           CONDENSE col_amt.
           length = STRLEN( col_amt ).
           if length = 16.
             REPLACE first OCCURRENCE OF ',' in col_amt with space.
             write :/'amount indian format:',col_amt.
           else.
           write :/'amount indian format:',col_amt.
           endif.
    ELSEIF NUM < 999999999 AND NUM >= 9999999.
           write num_1 using edit mask 'RR__,__,__,______' to col_amt.
           condense col_amt .
           length = STRLEN( COL_AMT ).
           if length = 13.
             REPLACE first OCCURRENCE OF ',' in col_amt with space.
             write :/'amount indian format:',col_amt.
           else.
             write :/'amount indian format:',col_amt.
          endif.
    ELSEIF NUM < 9999999  AND NUM >= 99999.
           write num_1 using edit mask 'RR__,__,______' to col_amt.
           condense col_amt .
           length = STRLEN( COL_AMT ).
           write :/'amount indian format:',col_amt.
    ELSEIF NUM < 99999.
       data : dumy(10) type c.
       dumy = num .
       CONDENSE dumy.
       length = STRLEN( dumy ).
         if length <= 6.
           write :/'amount indian format:',num.
           else.
           write num_1 using edit mask 'RR__,______' to col_amt.
           write :/'amount indian format:',col_amt.
          endif.
       ENDIF.
       uline.

  • Printing totals in words in footer window

    Hi all,
    I am trying to modify the standard form : RVINVOICE01.
    In main window i am getting the total Amount in Numbers. My requirement is to print that total Amount in Words in a Footer Window.
    Example:
    In Main Window if i get                       Total        : 1160 (KOMK-FKWRT)
    Then in Footer Window i have to display like this
    Total in  words :One Thousand One hundred sixty.
    how to do this ?
    Thanks in advance
    KR

    Hi Bujji,
    In Text elements of Footer window i have witen like this :
    /:     PERFORM ZK_WORD IN PROGRAM ZADIN01
    /:     USING &KOMK-FKWRT(I13)&
    /:     CHANGING &WORD1&
    /:     ENDPERFORM.
    AS  Total in Words: &word1&
    After  that i have created a Subroutine pool program called ZADIN01 , And in this i have written the folowing code.
    FORM ZK_WORD  TABLES INPUT STRUCTURE ITCSY
                                              OUTPUT STRUCTURE ITCSY.
    DATA: V_WORD1(100) TYPE C,
               V_FKWRT LIKE KOMK-FKWRT.
    READ TABLE INPUT INDEX 1.
    IF SY-SUBRC EQ 0.
    MOVE INPUT-VALUE TO V_FKWRT.
    ENDIF.
    CALL FUNCTION 'SPELL_AMOUNT'
      EXPORTING
       AMOUNT = V_FKWRT
    IMPORTING
       IN_WORDS = V_WORD1.
    ENDFORM.
    But the above code is giving the Error like : THE DATA OBJECT ''INPUT 'DOESNOT HAVE A COMPONENT CALLED 'VALUE'.
    How to slove this ? My code was  correct ?
    Thanks in advance

  • Character check total as word

    Hi all,
    1. Anyone know how to expand character Check total as word (i.e. Ten Thousand Eight Hundred Dollar only) generating by system in Checks for payment program? If there have any setting or coding need to adjust?
    2. How about maximum character is allow? I'm using SAP B1 2005 SP01 PL 45 and database Ms. SQL Server 2005. If there need to amend in database, how to adjust it?
    Thanks in advance.
    uddin
    Edited by: Muhd Mahyuddin Zakaria on Feb 3, 2009 12:55 PM

    Hi,
    I don't know if any standard method is available for that, but you can use following code:
        Public Function AmtToWords(ByVal Amount As Single) As String
            Dim Paise, Rupees As Integer
            Dim Words As String
            Dim N1, N2 As Integer
            Rupees = Amount
            Select Case Rupees
                Case Is <= 9
                    Words = Digit(Rupees)
                Case Is < 20
                    Words = EleToNin(Rupees)
                Case Is < 100
                    N2 = Rupees Mod 10
                    N1 = (Rupees - N2) / 10
                    Words = Ten(N1) & " " & IIf(N2 = 0, "", Digit(N2))
                Case Is < 1000
                    N2 = Rupees Mod 100
                    N1 = (Rupees - N2) / 100
                    Words = Digit(N1) & " Hundred " & AmtToWords(N2)
                Case Is < 100000
                    N2 = Rupees Mod 1000
                    N1 = (Rupees - N2) / 1000
                    Words = AmtToWords(N1) & " Thousand " & AmtToWords(N2)
                Case Is < 10000000
                    N2 = Rupees Mod 100000
                    N1 = (Rupees - N2) / 100000
                    Words = AmtToWords(N1) & " Lakhs " & AmtToWords(N2)
            End Select
            Return Words
        End Function
        Public Function Digit(ByVal Number As Integer) As String
            Select Case Number
                Case 0
                    Return ""
                Case 1
                    Return "One"
                Case 2
                    Return "Two"
                Case 3
                    Return "Three"
                Case 4
                    Return "Four"
                Case 5
                    Return "Five"
                Case 6
                    Return "Six"
                Case 7
                    Return "Seven"
                Case 8
                    Return "Eight"
                Case 9
                    Return "Nine"
            End Select
        End Function
        Public Function Ten(ByVal Number As Integer) As String
            Select Case Number
                Case 1
                    Return "Ten"
                Case 2
                    Return "Twenty"
                Case 3
                    Return "Thirty"
                Case 4
                    Return "Fourty"
                Case 5
                    Return "Fifty"
                Case 6
                    Return "Sixty"
                Case 7
                    Return "Seventy"
                Case 8
                    Return "Eighty"
                Case 9
                    Return "Ninety"
            End Select
        End Function
        Public Function EleToNin(ByVal Number As Integer) As String
            Select Case Number
                Case 10
                    Return "Ten"
                Case 11
                    Return "Eleven"
                Case 12
                    Return "Twelve"
                Case 13
                    Return "Thirteen"
                Case 14
                    Return "Fourteen"
                Case 15
                    Return "Fifteen"
                Case 16
                    Return "Sixteen"
                Case 17
                    Return "Seventeen"
                Case 18
                    Return "Eighteen"
                Case 19
                    Return "Nineteen"
            End Select
        End Function

  • How To See Numbers In Arabic Instead Of Indian Format

    I want to see numbers in Arabic format not in Indian format when i log on the Arabic Interface .
    I have EBS (12.0.6) installed on Linux centos , I have implement the below Oracle Metalink Note to solve this issue
    How To See Numbers In Arabic Instead Of Indian Format [ID 785243.1]
    I installed all the patched mentioned in the note (Apply forms version 10.1.2.2.0 with the forms patch 7488328 , Apply patch 7207440:R12.TXK.A , Apply patch 7601624 - NEW PROFILE OPTION: FORMS DIGIT SUBSTITUTION)
    These patches add the Profile option (FORMS DIGIT SUBSTITUTION) , but when i try to used it has no effect at all .
    So kindly if you have any idea about this issue please help me.
    Regards
    Fadi Lafi

    Hi,
    These patches add the Profile option (FORMS DIGIT SUBSTITUTION) , but when i try to used it has no effect at all .At what level you have set this profile option?
    So kindly if you have any idea about this issue please help me.Have you bounced the application services after setting this profile option? If not, please do so, login again and see if it works.
    Thanks,
    Hussein

  • How to use "&Total physical pages" in the format trigger?

    Hi all:
    How should I to use the system variable "&Physical page number" and "&Total physical pages" in the format
    trigger?
    I can not use these 2 variables in the format trigger directly or i will reveive an error message.
    Thank You!

    It may help you to know how I add JARs
    1. I open my Project (myProject)
    2. I Mount the JAR to the FileSystem (like mypackages.jar = which includes com.mus.de.myClass.java)
    3. I Mount the File to the FileSystem (like c:\..myfiles..\myProject)
    3.1 I add the File to my Project
    4. I select File | New -> Classes | Main
    4.1 I typed "import com.mus.de.myClass.java" to refer to this package.
    4.2 I called some of the public methods
    thats it
    Andreas

  • Tax and amount total should show in the line item of confirmation screen

    Hi All,
    I need to add the Tax and amount total fields in the line item of confirmation screen for service cart.
    Could someone please tell me how and where should I add and write the neccessary logic for that.
    We are on version SRM 3.0.
    Thanks,
    Kumar

    Hi,
    Please check the foll note for addition of custom fields:
    458591 - User-defined fields: Preparation and use
    672960 - User-defined fields 2
    To change the field content you need to implement the badi BBP_DOC_CHANGE_BADI .
    Here is the sample code for BBP_DOC_CHANGE_BADI Implementation
    loop at et_item into ls_item.
    move ls_item-mfrpn to ls_item-zz_your_new_field.
    modify et_item from ls_item transporting zz_your_new_field.
    endloop.
    BR,
    Disha.
    Pls reward points for useful answers.

Maybe you are looking for

  • How to Simulate The Excel LINEST Function in LabVIEW

    This may be a dummy question but I'm pressed for time.  I have used the Linear Fit.vi function to duplicate the Excel LINEST function and it works great.  However, the engineers here want to set the LINEST const option to FALSE.  How can I duplicate

  • Iphone 4s crashed when downloading IOS 8

    Trying to download IOS 8 to 4S phone it was stopped and now I can't restart.

  • Tolerance limit in cash desk

    Hi We are working on ECC 6 version. Here i want to know where we can set tolerance limit in cash desk. I know where to set it in finance, but that setting does not apply to cash desk. Please guide. Thanks Sweta

  • Creating and looking up Projects via a portlet

    Hello: I am wondering if there is an API so that I can create Projects programmatically via a portlet? Also once these projects are created, I would like to search them (based on the name of the Project) and provide a link to access them via another

  • Find and replace global variables

    Hi there, I've ran into a mess with my global variables. While I was trying to rename one of the globals, all instances in hundreds of subvis turned corrupt. The icon of the global variable turned black and the wires starting at the variable became b