Amount in Words (Indian Rupees)

Dear All,
I am using SAP 2007B PL 18.I have found out the below mentioned function for converting the amount to words in SDN only. But when i try and create the function it gives error "Incorrect Syntax near 00' . I think there is an incomplete syntax near the SubString function. Can someone please help me on the same and give the correct function.
Create function [dbo].[AmountToWords] ( @InNumber Numeric(18,2) )
--Returns the number as words.
returns VARCHAR(2000)
as
BEGIN
SET NoCount ON
Declare @Num Varchar(20)
Declare @Dec Varchar(3)
Declare @Return Varchar(2000)
Set @Dec = SubString(Convert(Varchar(20),@Innumber),Len(Convert(Varchar(20),@Innumber))-2,3)
Set @Num = SubString(Convert(Varchar(20),@Innumber),1, Len(Convert(Varchar(20),@Innumber))-3)
Declare @Hundred Char(8) Declare @HundredAnd Char(12) Declare @Thousand Char(9)
Declare @Lakh Char(5)
Declare @Lakhs Char(6)
Declare @Crore Char(6)
Declare @Crores Char(7)
Set @Hundred = 'Hundred '
Set @Thousand = 'Thousand '
Set @Lakh = 'Lakh '
Set @Lakhs = 'Lakhs '
Set @Crore = 'Crore '
Set @Crores = 'Crores '
Set @HundredAnd = 'Hundred and '
if Len(@Num) = 1
-- One
Begin
Set @Return = dbo.GetTextValue(@Num)
End
Else if Len(@Num) = 2
-- Ten
Begin
Set @Return = dbo.GetTextValue(@Num)
End
Else if Len(@Num) = 3
-- Hundred
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Hundred
IF SubString(@num,2,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2))
End
Else if Len(@Num) = 4
-- thousand
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Thousand
If SubString(@Num,2,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,1)) + @Hundred
IF SubString(@num,3,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2))
End
Else if Len(@Num) = 5
-- Ten Thousand
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,2)) + @Thousand
If SubString(@Num,3,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,1)) + @Hundred
IF SubString(@num,4,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2))
End
Else if Len(@Num) = 6
-- Lakh
Begin
If SubString(@Num,1,1) = '1'
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Lakh
Else
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Lakhs
If SubString(@Num,2,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2)) + @Thousand
If SubString(@Num,4,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,1)) + @Hundred
IF SubString(@num,5,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2))
End
Else if Len(@Num) = 7
-- Ten Lakhs
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,2)) + @Lakhs
If SubString(@Num,3,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2)) + @Thousand
If SubString(@Num,6,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,1)) + @Hundred
IF SubString(@num,6,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2))
End
Else if Len(@Num) = 8
-- Crore
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,1)) + @Crore
If SubString(@Num,2,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2)) + @Lakhs
If SubString(@Num,4,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2)) + @Thousand
If SubString(@Num,6,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,1)) + @Hundred
IF SubString(@num,7,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,2))
End
Else if Len(@Num) = 9
-- Ten Crore
Begin
Set @Return = dbo.GetTextValue(SubString(@Num,1,2)) + @Crores
If SubString(@Num,3,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2)) + @Lakhs
If SubString(@Num,5,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2)) + @Thousand
If SubString(@Num,7,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,1)) + @Hundred
IF SubString(@num,8,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,2))
End
Else if Len(@Num) = 10
-- Hundred Crore
Begin
Set @Return = dbo.GetTextValue(Substring(@Num,1,1)) + @Hundred
IF Substring(@Num,2,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,2,2))
Set @Return = @Return + @Crores
If SubString(@Num,4,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2)) + @Lakhs
If SubString(@Num,6,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2)) + @Thousand
If SubString(@Num,8,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,1)) + @Hundred
IF SubString(@num,9,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,9,2))
End
Else if Len(@Num) = 11
-- Thousand Crore
Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,1)) + @Thousand
IF SubString(@Num,2,1) '0'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,2,1)) + @Hundred
IF Substring(@Num,3,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,3,2))
Set @Return = @Return + @Crores If SubString(@Num,5,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2)) + @Lakhs
If SubString(@Num,7,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,2)) + @Thousand
If SubString(@Num,9,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,9,1)) + @Hundred
IF SubString(@num,10,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,10,2))
End
Else if Len(@Num) = 12
-- Ten thousand Crore
Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,2)) + @Thousand
IF SubString(@Num,3,1) '0'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,3,1)) + @Hundred
IF Substring(@Num,4,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,4,2))
Set @Return = @Return + @Crores If SubString(@Num,6,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2)) + @Lakhs
If SubString(@Num,8,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,2)) + @Thousand
If SubString(@Num,10,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,10,1)) + @Hundred
IF SubString(@num,11,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,11,2))
End
Else if Len(@Num) = 13
-- Lakh Crore
Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,1)) + @Lakh
If Substring(@Num,2,2) '00'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,2,2)) + @Thousand
IF SubString(@Num,4,1) '0'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,4,1)) + @Hundred
IF Substring(@Num,5,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,5,2))
Set @Return = @Return + @Crores
If SubString(@Num,7,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,7,2)) + @Lakhs
If SubString(@Num,9,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,9,2)) + @Thousand
If SubString(@Num,11,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,11,1)) + @Hundred
IF SubString(@num,12,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,12,2))
End
Else if Len(@Num) = 14
-- Ten Lakh Crore
Begin Set @Return = dbo.GetTextValue(Substring(@Num,1,2)) + @Lakhs
If Substring(@Num,3,2) '00'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,3,2)) + @Thousand
IF SubString(@Num,5,1) '0'
Set @Return = @Return + dbo.GetTextValue(Substring(@Num,5,1)) + @Hundred
IF Substring(@Num,6,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,6,2))
Set @Return = @Return + @Crores If SubString(@Num,8,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,8,2)) + @Lakhs
If SubString(@Num,10,2) '00'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,10,2)) + @Thousand
If SubString(@Num,12,1) '0'
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,12,1)) + @Hundred
IF SubString(@num,13,2) '00'
Set @Return = @Return + 'And '
Set @Return = @Return + dbo.GetTextValue(SubString(@Num,13,2))
End
If @Dec '.00'
Set @Return = @Return + 'Rupees And ' + dbo.GetTextValue(SubString(@Dec,2,2)) + 'Paise Only'
ELSE
Set @Return =@Return+'Zero Rupees Only'
Return @return
End
CREATE Function [dbo].[GetTextValue] ( @dblNumber Numeric )
Returns Varchar(1000)
As
Begin
Declare @StrWord Varchar(400)
SET @strWord = Case @dblNumber
When 1 Then 'One '
When 2 Then 'Two '
When 3 Then 'Three '
When 4 Then 'Four '
When 5 Then 'Five '
When 6 Then 'Six '
When 7 Then 'Seven '
When 8 Then 'Eight '
When 9 Then 'Nine '
When 10 Then 'Ten '
When 11 Then 'Eleven '
When 12 Then 'Twelve '
When 13 Then 'Thirteen '
When 14 Then 'Fourteen '
When 15 Then 'Fifteen '
When 16 Then 'Sixteen '
When 17 Then 'Seventeen '
When 18 Then 'Eighteen '
When 19 Then 'Nineteen '
When 20 Then 'Twenty '
When 21 Then 'Twenty One '
When 22 Then 'Twenty Two '
When 23 Then 'Twenty Three '
When 24 Then 'Twenty Four '
When 25 Then 'Twenty Five '
When 26 Then 'Twenty Six '
When 27 Then 'Twenty Seven '
When 28 Then 'Twenty Eight '
When 29 Then 'Twenty Nine '
When 30 Then 'Thirty '
When 31 Then 'Thirty One '
When 32 Then 'Thirty Two '
When 33 Then 'Thirty Three '
When 34 Then 'Thirty Four '
When 35 Then 'Thirty Five '
When 36 Then 'Thirty Six '
When 37 Then 'Thirty Seven '
When 38 Then 'Thirty Eight '
When 39 Then 'Thirty Nine '
When 40 Then 'Fourty '
When 41 Then 'Fourty One '
When 42 Then 'Fourty Two '
When 43 Then 'Fourty Three '
When 44 Then 'Fourty Four '
When 45 Then 'Fourty Five '
When 46 Then 'Fourty Six '
When 47 Then 'Fourty Seven '
When 48 Then 'Fourty Eight '
When 49 Then 'Fourty Nine '
When 50 Then 'Fifty '
When 51 Then 'Fifty One '
When 52 Then 'Fifty Two '
When 53 Then 'Fifty Three '
When 54 Then 'Fifty Four '
When 55 Then 'Fifty Five '
When 56 Then 'Fifty Six '
When 57 Then 'Fifty Seven '
When 58 Then 'Fifty Eight '
When 59 Then 'Fifty Nine '
When 60 Then 'Sixty '
When 61 Then 'Sixty One '
When 62 Then 'Sixty Two '
When 63 Then 'Sixty Three '
When 64 Then 'Sixty Four '
When 65 Then 'Sixty Five '
When 66 Then 'Sixty Six '
When 67 Then 'Sixty Seven '
When 68 Then 'Sixty Eight '
When 69 Then 'Sixty Nine '
When 70 Then 'Seventy '
When 71 Then 'Seventy One '
When 72 Then 'Seventy Two '
When 73 Then 'Seventy Three '
When 74 Then 'Seventy Four '
When 75 Then 'Seventy Five '
When 76 Then 'Seventy Six '
When 77 Then 'Seventy Seven '
When 78 Then 'Seventy Eight '
When 79 Then 'Seventy Nine '
When 80 Then 'Eighty '
When 81 Then 'Eighty One '
When 82 Then 'Eighty Two '
When 83 Then 'Eighty Three '
When 84 Then 'Eighty Four '
When 85 Then 'Eighty Five '
When 86 Then 'Eighty Six '
When 87 Then 'Eighty Seven '
When 88 Then 'Eighty Eight '
When 89 Then 'Eighty Nine '
When 90 Then 'Ninety '
When 91 Then 'Ninety One '
When 92 Then 'Ninety Two '
When 93 Then 'Ninety Three '
When 94 Then 'Ninety Four '
When 95 Then 'Ninety Five '
When 96 Then 'Ninety Six '
When 97 Then 'Ninety Seven '
When 98 Then 'Ninety Eight '
When 99 Then 'Ninety Nine '
When 100 Then 'One hundred '
else ' '
End
Return @strWord
End
Regards,
Rahul

Dear Rahul,
Try this,
->> Create 1 UDF in Header on Requrie Documents (ex. Marketing Documents).
->> Create 3 Function in MSSQL Server Management.
->> Create 1 FMS in Query Generator and save as Query Manager then Assign to UDF for Amount in Words.
for example:
Create UDF in Header on Marketing Documents.
->> Choose Tools on Top menu.
->> User - Defined Fields. -> User Manage Fields.
->> Open the User Manage Fields Widnow.
->> Marketing Documents. -> Title.
->> Select Title and Click Add button in Bottom on User Manage Fields Window.
->> Create Amount in Words UDF(Code, Discription and Type - Character) and Add the UDF.
Create Function in MSSQL Server Management.
Check this Link, (have 3 Functions in Link).
http://techcreeze.blogspot.com/2008/11/convert-amount-into-words-according-to_15.html
1st Funciton - to Convert one Digit Number to words
2nd Funciton - to convert 2 digit number to words.
3rd Funciton - to convert amt in numbers to words.
->> Open the MSSQL Server Management Window.
->> Choose your Company database and Create NEW Query.
->> Create 3 Function Queries one by one.
->> Create 3 NEW Query Tab and 1st one put the 1st Function then Run the Function. and
2nd New Query tab put the 2nd Function then Run the Function.
3rd New Query tab put the 3rd Function then Run the Function.
Create FMS in Query Generator and Save as Query Manager.
->> Adminstration.
->> Reports. -> Query Generator.
->> Open the Query Generator and put the below FMS query.
for example : Purchase Order Doc. Toal(in wrods).
declare @Doc_total numeric (19,6)
set @Doc_total=$[OPOR.DocTotal]
select  dbo.fNumToWords (@Doc_total)
->> Assign the FMS in UDF on Purchase Order.
->> Auto Refresh of Document Total.
Ex.
1. Goto the UDF and Clcik ShiftAltF2.
2. Select the SEARCH BY SAVED QUERY.
3. Assign the FMS Query.
4. Select the AUTO REFRESH WHEN FIELD CHENGES.
5. Select Document Total.
6. Check the Display Saved Values.

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.

  • Amount in words in SAP 8.8

    Hello expert,
                        I want to  convert the document amount in words in Indian standard and I am using the  below Functions which I got from sdn and its working fine in SAP 2007 but it is giving error in SAP 8.8 and patch level is 5.........please give the feasible solution.....
    1. Function to Convert one Digit Number to words.
    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
    2. Function to convert 2 digit number to words.
    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
    3. Function to convert amt in numbers to words. (Built with the help of above 2 functions)
    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
    ->> Create 1 UDF in Header on Requrie Documents (ex. Marketing Documents).
    ->> Create 3 Function in MSSQL Server Management.
    ->> Create 1 FMS in Query Generator and save as Query Manager then Assign to UDF for Amount in Words.
    for example:
    Create UDF in Header on Marketing Documents.
    ->> Choose Tools on Top menu.
    ->> User - Defined Fields. -> User Manage Fields.
    ->> Open the User Manage Fields Widnow.
    ->> Marketing Documents. -> Title.
    ->> Select Title and Click Add button in Bottom on User Manage Fields Window.
    ->> Create Amount in Words UDF(Code, Discription and Type - Character) and Add the UDF.
    Create Function in MSSQL Server Management.
    Check this Link, (have 3 Functions in Link).
    http://techcreeze.blogspot.com/2008/11/convert-amount-into-words-according-to_15.html
    1st Funciton - to Convert one Digit Number to words
    2nd Funciton - to convert 2 digit number to words.
    3rd Funciton - to convert amt in numbers to words.
    ->> Open the MSSQL Server Management Window.
    ->> Choose your Company database and Create NEW Query.
    ->> Create 3 Function Queries one by one.
    ->> Create 3 NEW Query Tab and 1st one put the 1st Function then Run the Function. and
    2nd New Query tab put the 2nd Function then Run the Function.
    3rd New Query tab put the 3rd Function then Run the Function.
    Create FMS in Query Generator and Save as Query Manager.
    ->> Adminstration.
    ->> Reports. -> Query Generator.
    ->> Open the Query Generator and put the below FMS query.
    for example : Purchase Order Doc. Toal(in wrods).
    declare @Doc_total numeric (19,6)
    set @Doc_total=$[OPOR.DocTotal]
    select  dbo.fNumToWords (@Doc_total)
    ->> Assign the FMS in UDF on Purchase Order.
    ->> Auto Refresh of Document Total.
    Ex.
    1. Goto the UDF and Clcik ShiftAltF2.
    2. Select the SEARCH BY SAVED QUERY.
    3. Assign the FMS Query.
    4. Select the AUTO REFRESH WHEN FIELD CHENGES.
    5. Select Document Total.
    6. Check the Display Saved Values.

    Hi Neetu,
    its not converting decimal values  in paisa...
    Regards
    Deepak tyagi

  • Converting the amount in words

    Hi ,
    Issues is like if the amount is $137,510.82 for US currency it should give as   ONE HUNDRED THIRTY-SEVEN THOUSAND FIVE HUNDRED TEN USD and 82/100.
    But when the document currency is german in the check it should give as ONE HUNDRED THIRTY THOPUSAND AND 51082/100.
    THE LOGIC SHOULD BE CURRENCY DEPENDENT.
    HOW DO I DI THIS...

    following is a customized report to convert amount to words...
    *& Report  ZCFM_REPT_RUPEE_CONVERSION                                  *
    *This report is a copy of report 'ZRUPECO1' in Tengl server            *
    Date                    :  25-Oct-2006                               *
    Author                  :  Amiya Shrivastava                         *
    Title                   :  Report to convert amount into words as per*
                               Indian spelling conventions               *
    Original Request number :  DEVK917286                                *
    report  zcfm_rept_rupee_conversion              .
    include zcfm_incl_rupee_conv_data.
    *&      Form  COVERSION1
          text
         -->NUMBER     text
         -->ANS        text
    form coversion1 using number changing ans.
      clear: gtab,
             giritab,
             giriline,
             girijtab,
             line ,
             ans,
             init, initnam, initno , init1,
             cnam1, cnam2, cnam3,cnam4, point,jpoint,
             kpoint,lpoint1, lpoint2,lpoint,fpoint,
             cnt1 , cnt2, cnt3 ,
             flhun, flth, flla, flcr1,flcr2, flchu1, flchu2, flpt, res.
      refresh :
             itab ,
             ktab ,
             jtab .
      init = number.
      init1 = init.
      cnt1 = strlen( init ).
      cnt2 = cnt1 - 1.
      do cnt1 times.
        initnam = init+0(1).
        shift init by 1 places left.
        if initnam = '.'.
          cnam1 = init1+0(initno).
        endif.
        initno = initno + 1.
      enddo.
      do cnt1 times.
        cnam2 = init1+0(1).
        shift init1 by 1 places left.
        if cnam2 = '.'.
          point = init1+0(2).
          exit.
        endif.
      enddo.
      do 2 times.
        jpoint = point+0(1).
        shift point by 1 places left.
        if sy-index = 1.
          kpoint = point.
        endif.
        perform points.
      enddo.
      cnt1 = strlen( cnam1 ).
      do cnt1 times.
        cnam2 = cnam1+0(1).
        perform calcu .
        shift cnam1 by 1 places left.
      enddo.
      sort itab descending by index.
      loop at itab.
        if sy-tabix = 1.
          jtab-result = itab-result.
          jtab-index = itab-index.
          append jtab.
        else.
          if itab-result = 'One  ' and  ( sy-tabix = 2 or sy-tabix = 5 or
                    sy-tabix = 7 or sy-tabix = 9 ).
            perform teens.
            move space to line-result.
            modify jtab from line index cnt3 transporting result .
          else.
            if itab-result <> space.
              perform ties.
            else.
              jtab-result = itab-result.
              jtab-index = itab-index.
              append jtab.
            endif.
          endif.
        endif.
        cnt3 = sy-tabix.
        res = itab-result.
      endloop.
      skip.
      loop at jtab.
        case sy-tabix.
          when 10.
            if jtab-result <> space.
              if flcr1 = 'X' and flcr2 = 'X'.
                concatenate jtab-result 'Hundred Crores' into line-result
                      separated by ' '.
                modify jtab from line index sy-tabix transporting result.
              else.
                concatenate jtab-result 'Hundred AND' into line-result
                      separated by ' '.
                modify jtab from line index sy-tabix transporting result.
              endif.
            endif.
          when 9.
            if flcr1 = 'X'.
              if jtab-result <> space.
                concatenate jtab-result 'Crores' into line-result
                                separated by ' '.
                modify jtab from line index sy-tabix transporting result.
              else.
                flcr2 = 'X'.
              endif.
            endif.
          when 8.
            if jtab-result <> space.
              concatenate jtab-result 'Crores' into line-result
                              separated by ' '.
              modify jtab from line index sy-tabix transporting result.
            else.
              flcr1 = 'X'.
            endif.
          when 7.
            if flla = 'X'.
              if jtab-result <> space.
                concatenate jtab-result 'Lacs' into line-result
                            separated by ' '.
                modify jtab from line index sy-tabix transporting result.
              endif.
            endif.
          when 6.
            if jtab-result <> space.
              concatenate jtab-result 'Lacs' into line-result
                             separated by ' '.
              modify jtab from line index sy-tabix transporting result.
            else.
              flla = 'X'.
            endif.
          when 5.
            if jtab-result <> space.
              if flth = 'X'.
                concatenate jtab-result 'Thousand' into line-result
                 separated by ' '.
                modify jtab from line index sy-tabix transporting result.
              endif.
            endif.
          when 4.
            if jtab-result <> space.
              concatenate jtab-result 'Thousand' into line-result
                       separated by ' '.
              modify jtab from line index sy-tabix transporting result.
            else.
              flth = 'X'.
            endif.
          when 3.
            if jtab-result <> space.
              if flchu1 = 'X' and flchu2 = 'X'.
                concatenate jtab-result 'Hundred' into line-result
                    separated by ' '.
              else.
                concatenate jtab-result 'Hundred AND' into line-result
                    separated by ' '.
              endif.
              modify jtab from line index sy-tabix transporting result.
            else.
              flhun = 'X'.
            endif.
          when 2.
            if jtab-result = space.
              flchu2 = 'X'.
            endif.
          when 1.
            if jtab-result = space.
              flchu1 = 'X'.
            endif.
        endcase.
      endloop.
    *SORT JTAB ASCENDING BY INDEX.
      loop at jtab.
        if sy-tabix = 1.
          cnam4 = jtab-result.
        else.
          concatenate jtab-result cnam4  into cnam4 separated by space.
        endif.
      endloop.
      if lpoint2 = space and lpoint1 = space.
        lpoint = 'only'.
      else.
        concatenate 'Paise' lpoint2 lpoint1 'only' into lpoint separated by
        space.
      endif.
      if cnam4 <> space.
        shift cnam4 left deleting leading space.
        concatenate 'Rupees' cnam4 lpoint into ans separated by space.
    *WRITE : / 'RUPEES', CNAM4.
    *WRITE : / ANS.
      endif.
    endform.                                                    "COVERSION1
    *WRITE : / LPOINT NO-GAP.
    form ties.
      jtab-index = itab-index.
      if sy-tabix = 2 or sy-tabix = 5 or sy-tabix = 7 or sy-tabix = 9.
        case itab-result.
          when 'Two  '.
            jtab-result = 'Twenty'.
          when 'Three'.
            jtab-result = 'Thirty'.
          when 'Four '.
            jtab-result = 'Fourty'.
          when 'Five '.
            jtab-result = 'Fifty'.
          when 'Six  '.
            jtab-result = 'Sixty'.
          when 'Seven'.
            jtab-result = 'Seventy'.
          when 'Eight'.
            jtab-result = 'Eighty'.
          when 'Nine '.
            jtab-result = 'Ninety'.
          when space.
            jtab-result = space.
        endcase.
      else.
        jtab-result = itab-result.
      endif.
      append jtab.
    endform.                    "TIES
    *&      Form  TEENS
          text
    form teens.
      jtab-index = itab-index.
      case res.
        when 'One  '.
          jtab-result = 'Eleven'.
        when 'Two  '.
          jtab-result = 'Twelve'.
        when 'Three'.
          jtab-result = 'Thirteen'.
        when 'Four '.
          jtab-result = 'Fourteen'.
        when 'Five '.
          jtab-result = 'Fifteen'.
        when 'Six  '.
          jtab-result = 'Sixteen'.
        when 'Seven'.
          jtab-result = 'Seventeen'.
        when 'Eight'.
          jtab-result = 'Eighteen'.
        when 'Nine '.
          jtab-result = 'Nineteen'.
        when space.
          jtab-result = 'Ten'.
      endcase.
      append jtab.
    endform.                    "TEENS
    *&      Form  CALCU
          text
    form calcu .
      itab-index = sy-index.
      case cnam2.
        when '1'.
          itab-result = 'One'.
        when '2'.
          itab-result = 'Two'.
        when '3'.
          itab-result = 'Three'.
        when '4'.
          itab-result = 'Four'.
        when '5'.
          itab-result = 'Five'.
        when '6'.
          itab-result = 'Six'.
        when '7'.
          itab-result = 'Seven'.
        when '8'.
          itab-result = 'Eight'.
        when '9'.
          itab-result = 'Nine'.
        when '0'.
          itab-result = space.
      endcase.
      append itab.
    endform.                    "CALCU
    *&      Form  POINTS
          text
    form points.
      if sy-index = 2.
        if fpoint = space.
          case jpoint.
            when '1'.
              lpoint1 = 'One'.
            when '2'.
              lpoint1 = 'Two'.
            when '3'.
              lpoint1 = 'Three'.
            when '4'.
              lpoint1 = 'Four'.
            when '5'.
              lpoint1 = 'Five'.
            when '6'.
              lpoint1 = 'Six'.
            when '7'.
              lpoint1 = 'Seven'.
            when '8'.
              lpoint1 = 'Eight'.
            when '9'.
              lpoint1 = 'Nine'.
            when '0'.
              lpoint1 = space.
          endcase.
        endif.
      endif.
      if sy-index = 1.
        case jpoint.
          when '1'.
            perform lpointy.
          when '2'.
            lpoint2 = 'Twenty'.
          when '3'.
            lpoint2 = 'Thirty'.
          when '4'.
            lpoint2 = 'Forty'.
          when '5'.
            lpoint2 = 'Fifty'.
          when '6'.
            lpoint2 = 'Sixty'.
          when '7'.
            lpoint2 = 'Seventy'.
          when '8'.
            lpoint2 = 'Eighty'.
          when '9'.
            lpoint2 = 'Ninety'.
          when '0'.
            lpoint2 = space.
        endcase.
      endif.
    endform.                    "POINTS
    *&      Form  LPOINTY
          text
    form lpointy.
      case kpoint.
        when '1'.
          lpoint2 = 'Eleven'.
        when '2'.
          lpoint2 = 'Twelve'.
        when '3'.
          lpoint2 = 'Thirteen'.
        when '4'.
          lpoint2 = 'Fourteen'.
        when '5'.
          lpoint2 = 'Fifteen'.
        when '6'.
          lpoint2 = 'Sixteen'.
        when '7'.
          lpoint2 = 'Seventeen'.
        when '8'.
          lpoint2 = 'Eighteen'.
        when '9'.
          lpoint2 = 'Nineteen'.
        when '0'.
          lpoint2 = 'Ten'.
      endcase.
      lpoint1 = space.
      fpoint = 'X'.
    endform.                    "LPOINTY

  • Spell amount in words

    Hi,
        I have a smartform based on the document type it should display the total amount in INR(Indian Ruppes) or USD(US dollars).Based on doc type how i can get the total amount in words.
    If Doc.Type = 'X'
        Rupees Hundred and Twenty Three Only
    If Doc.TYpe = 'Y'
         USD Hundred and Twenty Three Only

    Hi
    In the corresponding text element you have to place a alternative option in that make a condition that
           doc number = 'x'.
    If the condition is true means the system will go for a 'YES' Option  and Place a text element and call a function module to spell the amount.
    If the conditon is NO Means the system will execute the rest and as said for the above conditon here also u have incorporate the textelemt and call a function module as pass the detials as per your requirement.
    Thanks and Regards
    Arun Joseph

  • Amount in words problem

    Hi All,
    Please help me to get Amount in words in Indian standards
    i.e
    if amount is 125000 then it should print
    "One Lakh Twenty-five thousand rupees only"
    All these I need in a Check Print layout
    here i  can see amount but how will i get Amount in words there.
    I have made a query CheckPrint
    which contains follwing fields from OPCH (A/P Invoice table)
    DocNum , DocDate, CardName, DocTotal.
    I just want DocTotal in words so that i can display it on the layout and get the print on Cheque.
    I am using SAP 2005 B version.
    Please help I am not a trained professional in SAP Business One
    Kindly do the needful.
    Thanks and Regards,
    Murtaza Piyersoap

    Hi Murtaza,
    I had a similar issue, and I addressed it by:
    1. Creating a UDF in the Payments>Title called AmountInWord of Type AlphaNumeric Structure Text (i.e. in OVPM Table)
    2. Created a Function called I_ConvertN2W in the database, which converts any number into Words as per Indian Style i.e. Lakh, Crore
    3. In the SBO_SP_TransactionNotification, I am filling the Value in the UDF on every Add of Outgoing Payment
    4. In the PLD for the printing of the cheque, I am using the UDF, instead of the SAPB1 Amount (which is non Indian Style)
    Step 1:
    Create the UDF as mentioned above, I guess no further explanation required
    Step 2:
    Creating the Function I_ConvertN2W, but first you will have to create all the support functions, I am listing the function in the order of creation
    CREATE FUNCTION I_Modulus (@INPUT INT, @DIVIDER INT) 
    RETURNS INT AS 
    BEGIN
    DECLARE @RETVAL AS INT, @MODULUS AS INT
    IF @INPUT = @DIVIDER
    BEGIN
         SET @RETVAL = 0
    END
    IF @INPUT < @DIVIDER
    BEGIN
         SET @RETVAL = @INPUT
    END
    SET @MODULUS = @INPUT
    WHILE @MODULUS >= @DIVIDER
    BEGIN
         SET @MODULUS = @MODULUS - @DIVIDER
    END
    SET @RETVAL = @MODULUS
    RETURN (@RETVAL)
    END
    CREATE FUNCTION I_Mid (@sInput VARCHAR(8000), @iStart INT, @iLen INT) 
    RETURNS VARCHAR(8000) AS 
    BEGIN
    --Adapted from the Mid function of Visual Basic
    DECLARE @sRetVal AS VARCHAR(8000)
    IF @iLen = 0
    BEGIN
         SET @iLen = LEN(@sInput)-(@iStart-1)
    END
    SET @sRetVal = RIGHT(@sInput,LEN(@sInput) - (@iStart-1))
    SET @sRetVal = LEFT(@sRetVal,@iLen)
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_CN2W_GetWord (@cValue INT) 
    RETURNS nvarchar(10)
    AS 
    BEGIN
    DECLARE @sRetVal AS NVARCHAR(10)
    SET @sRetVal =
         CASE
              WHEN @cValue = 0 THEN ''
              WHEN @cValue = 1 THEN 'One'
              WHEN @cValue = 2 THEN 'Two'
              WHEN @cValue = 3 THEN 'Three'
              WHEN @cValue = 4 THEN 'Four'
              WHEN @cValue = 5 THEN 'Five'
              WHEN @cValue = 6 THEN 'Six'
              WHEN @cValue = 7 THEN 'Seven'
              WHEN @cValue = 8 THEN 'Eight'
              WHEN @cValue = 9 THEN 'Nine'
              WHEN @cValue = 10 THEN 'Ten'
              WHEN @cValue = 11 THEN 'Eleven'
              WHEN @cValue = 12 THEN 'Twelve'
              WHEN @cValue = 13 THEN 'Thirteen'
              WHEN @cValue = 14 THEN 'Fourteen'
              WHEN @cValue = 15 THEN 'Fifteen'
              WHEN @cValue = 16 THEN 'Sixteen'
              WHEN @cValue = 17 THEN 'Seventeen'
              WHEN @cValue = 18 THEN 'Eighteen'
              WHEN @cValue = 19 THEN 'Ninteen'
              WHEN @cValue = 20 THEN 'Twenty'
              WHEN @cValue = 30 THEN 'Thirty'
              WHEN @cValue = 40 THEN 'Forty'
              WHEN @cValue = 50 THEN 'Fifty'
              WHEN @cValue = 60 THEN 'Sixty'
              WHEN @cValue = 70 THEN 'Seventy'
              WHEN @cValue = 80 THEN 'Eighty'
              WHEN @cValue = 90 THEN 'Ninty'
         END
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_CN2W_GetTens (@sValue as NVARCHAR(100)) 
    RETURNS NVARCHAR(100) AS 
    BEGIN
    DECLARE @sTens AS NVARCHAR(100), @iNum AS INT, @cnt AS INT, @iDigit AS INT, @sRetVal AS NVARCHAR(100)
    SET @iNum = CAST(@sValue AS INT)
    SET @sTens = ''
    IF @iNum <= 20
    BEGIN
         SET @sRetVal =  dbo.I_CN2W_GetWord(@iNum)
    END
    ELSE
    BEGIN
         SET @cnt = 1
         WHILE @iNum > 0
              BEGIN
                   SET @iDigit = dbo.I_Modulus(@iNum, 10)
                   IF @cnt = 1
                        SET @sTens = dbo.I_CN2W_GetWord(@iDigit)
                   ELSE
                   BEGIN
                        SET @iDigit = @iDigit * 10
                        SET @sTens = dbo.I_CN2W_GetWord(@iDigit) + ' ' + @sTens
                   END
                   SET @cnt = (@cnt + 1)
                   SET @iNum = (@iNum / 10)
              END
         SET @sRetVal = @sTens
    END
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_CN2W_GetHundreds (@sValue NVARCHAR(100)) 
    RETURNS NVARCHAR(100) AS 
    BEGIN
    DECLARE @rstHun as NVARCHAR(100), @sHun as NVARCHAR(100), @sTens AS NVARCHAR(100), @sRetVal as NVARCHAR(100)
    IF RTRIM(LTRIM(@sValue)) = '000'
    BEGIN
         SET @sRetVal = ''
    END
    ELSE
    BEGIN
         SET @sHun = SUBSTRING(RTRIM(LTRIM(@sValue)),1,1)
         SET @sTens = dbo.I_CN2W_GetTens(SUBSTRING(RTRIM(LTRIM(@sValue)),2,2))
         IF (LEN(RTRIM(LTRIM(@sTens))) > 0)
         BEGIN
              SET @rstHun = dbo.I_CN2W_GetWord(CONVERT(INT, @sHun))
              IF (LEN(RTRIM(LTRIM(@rstHun))) > 0)
              BEGIN
                   SET @rstHun = @rstHun + ' Hundred and ' + @sTens
              END
              ELSE
              BEGIN
                   SET @rstHun = @sTens
              END
         END
         ELSE
         BEGIN
              SET @rstHun = dbo.I_CN2W_GetWord(CONVERT(INT, @sHun)) + ' Hundred'
         END
         SET @sRetVal = @rstHun
    END
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_CN2W_GetThousands (@sValue NVARCHAR(100)) 
    RETURNS NVARCHAR(100) AS 
    BEGIN
    DECLARE @rstHun as NVARCHAR(100), @rstThou AS NVARCHAR(100), @strHun as NVARCHAR(100), @strNum AS NVARCHAR(100), @strThou AS NVARCHAR(100)
    DECLARE @sRetVal as NVARCHAR(100)
    IF @sValue = '00000'
    BEGIN
         SET @sRetVal = ''
    END
    ELSE
    BEGIN
         SET @strNum = RTRIM(LTRIM(@sValue))
         SET @strHun =
              CASE
                   WHEN LEN(@strNum) = 4 THEN SUBSTRING(@strNum,2,3)
                   ELSE SUBSTRING(@strNum,3,3)
              END
         SET @strThou = SUBSTRING(@strNum,1,LEN(@strNum)-3)
         SET @rstHun = dbo.I_CN2W_GetHundreds(@strHun)
         SET @rstThou =
              CASE
                   WHEN CAST(@strThou AS INT) <= 20 THEN dbo.I_CN2W_GetWord(CONVERT(INT, @strThou))
                   ELSE dbo.I_CN2W_GetTens(@strThou)
              END
         IF (LEN(@rstThou)>0)
         BEGIN
              SET @rstThou = @rstThou + ' Thousand ' + @rstHun
         END
         ELSE
         BEGIN
              SET @rstThou = @rstHun
         END
         SET @sRetVal = @rstThou
    END
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_CN2W_GetLakhs (@sValue NVARCHAR(100)) 
    RETURNS NVARCHAR(100) AS 
    BEGIN
    DECLARE @rstThou as NVARCHAR(100), @rstLakhs AS NVARCHAR(100), @strLakhs as NVARCHAR(100), @strNum AS NVARCHAR(100), @strThou AS NVARCHAR(100)
    DECLARE @sRetVal as NVARCHAR(100)
    IF @sValue = '0000000'
    BEGIN
         SET @sRetVal = ''
    END
    ELSE
    BEGIN
         SET @strNum = RTRIM(LTRIM(@sValue))
         SET @strThou =
              CASE
                   WHEN LEN(@strNum) = 6 THEN SUBSTRING(@strNum,2,5)
                   ELSE SUBSTRING(@strNum,3,5)
              END
         SET @strLakhs = SUBSTRING(@strNum,1,LEN(@strNum)-5)
         SET @rstThou = dbo.I_CN2W_GetThousands(@strThou)
         SET @rstLakhs =
              CASE
                   WHEN CAST(@strLakhs AS INT) <= 20 THEN dbo.I_CN2W_GetWord(CONVERT(INT, @strLakhs))
                   ELSE dbo.I_CN2W_GetTens(@strLakhs)
              END
         IF (LEN(@rstLakhs)>0)
         BEGIN
              SET @rstLakhs = @rstLakhs + ' Lakh ' + @rstThou
         END
         ELSE
         BEGIN
              SET @rstLakhs = @rstThou
         END
         SET @sRetVal = @rstLakhs
    END
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_CN2W_GetCrores (@sValue NVARCHAR(255)) 
    RETURNS NVARCHAR(255) AS 
    BEGIN
    DECLARE @rstCro as NVARCHAR(255), @rstLakhs AS NVARCHAR(255), @strNum as NVARCHAR(100), @strLakhs AS NVARCHAR(255), @strCro AS NVARCHAR(255)
    DECLARE @sRetVal as NVARCHAR(255)
    IF @sValue = '000000000'
    BEGIN
         SET @sRetVal = ''
    END
    ELSE
    BEGIN
         SET @strNum = RTRIM(LTRIM(@sValue))
         SET @strLakhs =
              CASE
                   WHEN LEN(@strNum) = 8 THEN SUBSTRING(@strNum,2,7)
                   ELSE SUBSTRING(@strNum,3,7)
              END
         SET @strCro = SUBSTRING(@strNum,1,LEN(@strNum)-7)
         SET @rstLakhs = dbo.I_CN2W_GetLakhs(@strLakhs)
         SET @rstCro =
              CASE
                   WHEN CAST(@strCro AS INT) <= 20 THEN dbo.I_CN2W_GetWord(CONVERT(INT, @strCro))
                   ELSE dbo.I_CN2W_GetTens(@strCro)
              END
         IF LEN(@rstCro)>0
         BEGIN
              SET @rstCro = @rstCro + ' Crore ' + @rstLakhs
         END
         ELSE
         BEGIN
              SET @rstCro = @rstLakhs
         END
         SET @sRetVal = @rstCro
    END
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_CN2W_GetArabs (@sValue NVARCHAR(255)) 
    RETURNS NVARCHAR(255) AS 
    BEGIN
    DECLARE @rstArab as NVARCHAR(255), @rstCro AS NVARCHAR(255), @strNum as NVARCHAR(255), @strCro AS NVARCHAR(255), @strArab AS NVARCHAR(255)
    DECLARE @sRetVal as NVARCHAR(255)
    IF @sValue = '00000000000'
    BEGIN
         SET @sRetVal = ''
    END
    ELSE
    BEGIN
         SET @strNum = RTRIM(LTRIM(@sValue))
         SET @strCro =
              CASE
                   WHEN LEN(@strNum) = 10 THEN SUBSTRING(@strNum,2,9)
                   ELSE SUBSTRING(@strNum,3,9)
              END
         SET @strArab = SUBSTRING(@strNum,1,LEN(@strNum)-9)
         SET @rstCro = dbo.I_CN2W_GetCrores(@strCro)
         SET @rstArab =
              CASE
                   WHEN CAST(@strArab AS INT) <= 20 THEN dbo.I_CN2W_GetWord(CONVERT(INT, @strArab))
                   ELSE dbo.I_CN2W_GetTens(@strArab)
              END
         IF LEN(@rstArab)>0
         BEGIN
              SET @rstArab = @rstArab + ' Arab ' + @rstCro
         END
         ELSE
         BEGIN
              SET @rstArab = @rstCro
         END
         SET @sRetVal = @rstArab
    END
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_CN2W_GetKharabs (@sValue NVARCHAR(255)) 
    RETURNS NVARCHAR(255) AS 
    BEGIN
    DECLARE @rstArab as NVARCHAR(255), @rstKharab AS NVARCHAR(255), @strNum as NVARCHAR(255), @strKharab AS NVARCHAR(255), @strArab AS NVARCHAR(255)
    DECLARE @sRetVal as NVARCHAR(255)
    IF @sValue = '10000000000000'
    BEGIN
         SET @sRetVal = 'Hundred Kharab '
    END
    ELSE
    BEGIN
         SET @strNum = RTRIM(LTRIM(@sValue))
         SET @strArab =
              CASE
                   WHEN LEN(@strNum) = 12 THEN SUBSTRING(@strNum,2,11)
                   ELSE SUBSTRING(@strNum,3,11)
              END
         SET @strKharab = SUBSTRING(@strNum,1,LEN(@strNum)-11)
         SET @rstArab = dbo.I_CN2W_GetArabs(@strArab)
         SET @rstKharab =
              CASE
                   WHEN CAST(@strKharab AS INT) <= 20 THEN dbo.I_CN2W_GetWord(CONVERT(INT, @strKharab))
                   ELSE dbo.I_CN2W_GetTens(@strKharab)
              END
         IF @rstKharab IS NOT NULL
         BEGIN
              SET @rstKharab = @rstKharab + ' Kharab ' + @rstArab
         END
         ELSE
         BEGIN
              SET @rstKharab = @rstArab
         END
         SET @sRetVal = @rstKharab
    END
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_CN2W_GetAbvKharab (@sValue NVARCHAR(255)) 
    RETURNS NVARCHAR(255) AS 
    BEGIN
    DECLARE @rstArab as NVARCHAR(255), @rstAbvKharab AS NVARCHAR(255), @strNum as NVARCHAR(255), @strArab AS NVARCHAR(255), @strAbvKharab AS NVARCHAR(255)
    DECLARE @sRetVal as NVARCHAR(255), @ONLY AS NVARCHAR(10)
    SET @ONLY = 'Only'
    SET @strNum = RTRIM(LTRIM(@sValue))
    SET @strArab = SUBSTRING(@strNum, ((LEN(@strNum)-11)+1),11)
    SET @strAbvKharab = SUBSTRING(@strNum,1,LEN(@strNum)-11)
    SET @rstArab = dbo.I_CN2W_GetArabs(@strArab)
    SET @rstAbvKharab = REPLACE(dbo.I_ConvertN2W(CONVERT(MONEY, @strAbvKharab),0),@ONLY,'')
    SET @rstAbvKharab = @rstAbvKharab + ' Kharab ' + @rstArab
    SET @sRetVal = @rstAbvKharab
    RETURN (@sRetVal)
    END
    CREATE FUNCTION I_ConvertN2W (@curNumber MONEY, @bPrefixCurrencyName BIT)
    RETURNS VARCHAR(400) AS 
    BEGIN
    ---This Function is an Adapted (Scaled Down) version of ConvertN2W from the ITCCF32.dll Custom Functions Library by Infinite Technologies
    ---Original and Adapted (SQL) both Versions authored by Murtaza R.E. This function is provided on AS IS WHERE IS BASIS
    ---This peice of code can be freely used for all puposes, however please Do Not Forget to mention the source
    ---Suggestions and Bugs can be send to me at murtaza1972 at gmail dot com, I do not assure an immediate fix, but will try as time permits
    ---If you find this peice of code helpful, please do drop me a mail, this will encourage me to do something more creative
    DECLARE @sRetVal AS VARCHAR(400), @RUP AS NVARCHAR(10), @PAISE AS NVARCHAR(10), @ONLY AS NVARCHAR(10)
    DECLARE @curr AS MONEY, @strFirst AS VARCHAR(100), @lngDeciLen AS INT, @strDeci AS VARCHAR(100)
    DECLARE @i AS INT, @rstDeci AS VARCHAR(100), @strNum as VARCHAR(400), @lngNum AS INT, @rstNum AS VARCHAR(400)
    DECLARE @rstWord AS VARCHAR(400)
    SET @RUP =
         CASE
              WHEN (@bPrefixCurrencyName = 1) THEN 'Rupees'
              ELSE ''
         END
    SET @PAISE = 'Paise'
    SET @ONLY = 'Only'
    SET @curr = @curNumber
    IF @curr < 0
    BEGIN     
         SET @sRetVal = NULL
    END
    IF @curr = 0
    BEGIN
         SET @sRetVal = @RUP + ' Zero ' + @ONLY
    END
    SET @strFirst = LTRIM(STR(@curNumber,30,2))
    SET @lngDeciLen =
         CASE
              WHEN PATINDEX('%.%',@strFirst) > 0 THEN (LEN(@strFirst)-PATINDEX('%.%',@strFirst))
              ELSE 0
         END
    IF @lngDeciLen <> 0
    BEGIN
         SET @i = CASE
                   WHEN PATINDEX('%.%',@strFirst) > 0 THEN (PATINDEX('%.%',@strFirst) + 1)
                   ELSE 0
              END
         SET @strDeci = dbo.I_Mid(@strFirst, @i, @lngDeciLen)
    END
    ELSE
    BEGIN
         SET @strDeci = '0'
    END
    SET @strDeci =
         CASE
              WHEN LEN(@strDeci) = 1 THEN (@strDeci + '0')
              ELSE @strDeci
         END
    SET @rstDeci = dbo.I_CN2W_GetTens(@strDeci)
    SET @i =
         CASE
              WHEN PATINDEX('%.%', @strFirst)>0 THEN (PATINDEX('%.%',@strFirst)-1)
              ELSE LEN(@strFirst)
         END
    SET @strNum = dbo.I_Mid(@strFirst,1,@i)
    IF (@strNum IS NULL) OR (LEN(@strNum)=0)
    BEGIN
         SET @strNum = '0'
    END
    IF CONVERT(MONEY,@strNum) <= 99999
    BEGIN
         SET @lngNum = CONVERT(INT,@strNum)
         SET @rstNum =
              CASE
                   WHEN (@lngNum <= 20) THEN dbo.I_CN2W_GetWord(@lngNum)
                   WHEN ((@lngNum > 21) AND (@lngNum <= 99)) THEN dbo.I_CN2W_GetTens(@strNum)
                   WHEN ((@lngNum > 99) AND (@lngNum <= 999)) THEN dbo.I_CN2W_GetHundreds(@strNum)
                   WHEN ((@lngNum > 999) AND (@lngNum <= 99999)) THEN dbo.I_CN2W_GetThousands(@strNum)
              END
    END
    IF CONVERT(MONEY,@strNum) > 99999
    BEGIN
         SET @rstNum =
              CASE
                   WHEN ((CONVERT(MONEY,@strNum) > 99999) AND (CONVERT(MONEY,@strNum) <= 9999999)) THEN dbo.I_CN2W_GetLakhs(@strNum)
                   WHEN ((CONVERT(MONEY,@strNum) > 9999999) AND (CONVERT(MONEY,@strNum) <= 999999999)) THEN dbo.I_CN2W_GetCrores(@strNum)
                   WHEN ((CONVERT(MONEY,@strNum) > 999999999) AND (CONVERT(MONEY,@strNum) <= 99999999999)) THEN dbo.I_CN2W_GetArabs(@strNum)
                   WHEN (CONVERT(MONEY,@strNum) <= 10000000000000) THEN dbo.I_CN2W_GetKharabs(@strNum)
                   WHEN (CONVERT(MONEY,@strNum) > 10000000000000) THEN dbo.I_CN2W_GetAbvKharab(@strNum)
              END
    END
    IF (LEN(RTRIM(LTRIM(@rstDeci))) = 0) OR (@rstDeci IS NULL)
    BEGIN
         SET @rstWord = @RUP + ' ' + @rstNum + ' ' + @ONLY
    END
    ELSE
    BEGIN
         IF (LEN(RTRIM(LTRIM(@rstNum))) > 0) OR (@rstNum IS NOT NULL)
         BEGIN
              SET @rstWord = @RUP + ' ' + @rstNum + ' and ' + @rstDeci + ' ' + @PAISE + ' ' + @ONLY
         END
         ELSE
         BEGIN
              SET @rstWord = @rstDeci + ' ' + @PAISE + ' ' + @ONLY
         END
    END
    SET @sRetVal =
         CASE
              WHEN ((LEN(RTRIM(LTRIM(@rstWord)))=0) OR (@rstWord IS NULL)) THEN 'Zero'
              ELSE REPLACE(RTRIM(LTRIM(@rstWord)),'  ',' ')
         END     
    RETURN (@sRetVal)
    END
    Step 3:
    Code in SBO_SP_TransactionNotification
    IF ((@object_type = '46') AND (@transaction_type = 'A')) -- Outgoing PAYMENT
    BEGIN
         DECLARE @sWords AS VARCHAR(400), @iValue AS MONEY
         SET @error = 46
         SET @iValue = (SELECT [CheckSum] FROM dbo.OVPM WHERE DocEntry = @list_of_cols_val_tab_del)
         SET @sWords =
              CASE
                   WHEN @iValue > 0 THEN dbo.I_ConvertN2W(@iValue,0) --call the function only when the value is more than 0
              END
         UPDATE dbo.OVPM
              SET U_AmountInWord = @sWords
              WHERE ((DocEntry = @list_of_cols_val_tab_del) AND ([CheckSum]>0)) --we want to update only when the means of payment is by cheque
         SET @error = 0 --success
    END
    xxxxxxxxxxxxxxxENDxxxxxxxxxxxxxxxxxx---
    This is being currently used by me, and works fine for me, I hope this will be useful to you and others
    Regards,
    Murtaza R.E.

  • 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

  • Indian Rupee Symbol in Smartform

    Hi All
    I have got a requirement in which i need to use the recently announced Indian Rupee Symbol in my Smartform. I need to use it in the table being displayed in the Smartform, in front of the Amount in each row, i need to dispaly the symbol.
    I have no idea of how to do it.
    Kindly help me out
    Thanks in Advance...

    Hi
    I Am Just New in the sap abap .
    i also have this type of requirnment for my smartform.
    i got the soluction
    here is the steps of rupee symbol in smartform.
    Step:- 1 Download Rupee Font From [http://blog.foradian.com/font-with-indian-rupee-symbol-download-and-us|http://blog.foradian.com/font-with-indian-rupee-symbol-download-and-us]
    Step:- 2 Open T-CODE SE73
    Step:- 3 Install True Type Font And Give Name To Font
    After sussfully instalation you can use that forn in your smartstyle and u can use that symbole
    NOTE:- To Insert Rupee symbole You Have To Press ` Button Near To 1 Key
    Soem Times it will not display in editor or in print Priview  but it will print in the hardcopy.
    Later On I Will Put Step By Step Step With Screenshot .
    If Anyone Have Emergency Then Replay Me i Will DO it
    Edited by: SAPABAP.IN on Nov 1, 2010 11:43 AM

  • Defaulting the new Indian Rupee symbol in Numbers

    In Numbers, when I choose Indian Rupee as currency in cell format, I am still getting the old Rupee symbol. When I try to change the symbol to the new one, the cell format is getting changed as text. 
    How do I default the new Rupee symbol in cell format?
    Meaning when I go to the inspector, under "Cells" when I choose Cell format as Currency, I get a drop down of various currencies, including that of Indian Rupee. Here I want the new symbol to be defaulted.

    As far as I know, the feature which is not a Numbers one but a system one is unavailable.
    At last Apple adopted a more correct list of currencies symbols but I guess that they will need about ten years to discover that there is a new one for the Indian Rupee.
    On my French System, your currency is displayed as "Rs".
    My own tip would be to use two columns, one fo the amounts, one for the Rupee symbol.
    We see the columns when the cursor is in the table but we don't see the separator, defined to None, when the cursor is no longer in the table.
    Of course, you are free to send a request to Apple thru the dedicated channel :
    Go to "Provide Numbers Feedback" in the "Numbers" menu, describe what you wish.
    Then, cross your fingers, and wait at least for iWork'11 or 12 ;-)
    I must add that I guess that if you get satisfaction one day, it will be an incomplete one.
    On my French system, the currecy used here is correctly displayed as € but if I run the system in a language unused in Europe, the same currency is displayed as Euro.
    Same behavior withe the dollar. When exemples are posted here by US askers we may see $ 12.45
    but if I run the original document here on my French system, I get : 12,45 $US
    Yvan KOENIG (VALLAURIS, France) samedi 29 octobre 2011 19:30:03
    iMac 21”5, i7, 2.8 GHz, 4 Gbytes, 1 Tbytes, mac OS X 10.6.8 and 10.7.2
    My iDisk is : <http://public.me.com/koenigyvan>
    Please : Search for questions similar to your own before submitting them to the community

  • PLD amount as per Indian Localization (High Priority)

    Dear All,
    I am Using SAP B One 2007B SP00 PL 07
    Problem is as follows:
    For example if the amount is 144400.44 INR. This amount is displayed as follows in PLD
    IN Figure: 144,400.44
    In words: one hundred and fourteen thousand four hundred and forty four hundreth only
    where as our requirement is as follows:
    In Figure: 1,44,400.44
    In words: one lakh fourty four thousand four hundred and fourty four paise only.
    This is generic requirement for Indian localizaion. Can any one resolve this issue since i was unable to get any solution on SAP forum.
    Regards
    swapnil

    Check this thread which answers your query
    How to convet Amount To Words in PLD      
    [How to convet Amount To Words in PLD;

  • Reg Currency Description and Amount in words

    Hi
    Can anybody help me out in finding Function Module for Currency Descripton and Amount in words.
    For  Example, if currency type is <b>USD</b> and the amount is <b>29,012.50</b>
    then it should display the currency description as <b>The sum of US Dollars</b> and the amount in words as <b>Twenty Nine Thousand Twelve and Cents Fifty</b> and it should work for any currency type.
    Thanks in Advance.
    Swathi

    Hi swathi,
    Cents are not known in SAP only USD with decimal places in known.
    however check if this can solve teh problem...
    for indian currency inr use the below function module....
    HR_IN_CHG_INR_WRDS
    for usd currency use the following code as an example..
    data: amt_in type  pc207-betrg value '29012.50'.
    data: words type spell.
    data: result type string.
    call function 'SPELL_AMOUNT'
    exporting
       amount          = amt_in
       currency        = 'USD'
      FILLER          = ' '
      LANGUAGE        = SY-LANGU
    importing
       in_words        = words
    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 'USD' words-word 'AND' words-decword 'CENTS'
             into result separated by space.
    write:/ result.
    hope this helps,
    all the best,
    sampath
    award helpful answers

  • Need Indian Rupees Format in PLD - SAP B1

    Hi Experts,
         I need the Indian Rupees format.. the below image shows wrong in last word.. instead of paisa.. it shows hundereths in PLD..
         I used colsum("F_306") and marked as sum in words
        Give me a solution ASAP.
    thanks in advance
    warm regards
    Guhan

    Hi Nishit,
        I tried your above formula and its not working
    NumberVar paisa = F_333 mod 100;
    ToWords(Truncate(F_333)) + " and " + ToWords(paisa) + " paisa"
    Actually I used
        ColSum("F_306") for totaling in Repetitive Area Footer1 - the field name is F_333.
        So i need sum in words of the F_333 field in Indian format..
    Thanks in advance
    regards
    Guhan

  • Converting amount to words

    how can i convert amount to words using sql query
    eg : Rs 10234.50
    Ten Thousand Two Hundred Thirty Four Rupees Fifty Paise

    Perhaps the forum admin need to put the search box right next to the Create New Message button just so people get the idea that what they're asking for just may have been asked for previously by other people.As when creating a new SR in Metalink: Before posting you'll be asked to to search the bug db, knowledge base, technical forums ...etc ...
    Not really a bad idea actually ...

  • Amount in words display Problem in sapscript

    Hi All,
    I am worked on cheque print out. I have an amount in words u2018nine crore seventy two lakh thirty three thousand nine hundred ninety nine rupees fifty eight paise onlyu2019 based on the amount value, I have a number of character 105. How will u split the character 50 and 55 character?

    Hi,
    Try this code
    First 50 characters will be in first line of OUT_LINES. Remaining you can concatenate from line 2 and 3
    DATA : OUT_LINES TYPE TABLE OF STRING.
    CALL FUNCTION 'RKD_WORD_WRAP'
      EXPORTING
        TEXTLINE                  = 'nine crore seventy two lakh thirty three thousand nine hundred ninety nine rupees fifty eight paise only'
    *   DELIMITER                 = ' '
        OUTPUTLEN                 = 50
    * IMPORTING
    *   OUT_LINE1                 =
    *   OUT_LINE2                 =
    *   OUT_LINE3                 =
    TABLES
       OUT_LINES                 = OUT_LINES
    * EXCEPTIONS
    *   OUTPUTLEN_TOO_LARGE       = 1
    *   OTHERS                    = 2
    IF SY-SUBRC <> 0.
    * MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
    *         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.

Maybe you are looking for

  • Printing with FF 4.0 is slow and generated print files are huge

    I tried the RC and released versions of Firefox 4.0 and found the printer module(?) doesn't work as it did in version 3.x If I print to my laser printer it generates each page slowly (I'm guessing it turns it into graphics) or if I print to a PDF fil

  • WKSYS. Packages error PLS-00753

    After full import: impdp DIRECTORY=DATAPUMP_IMPORT DUMPFILE=orcl.dmp FULL=y LOGFILE=import.log wksys. has many package bodies that import with error PLS-00753 malformed or currupted wrapped unit.. how do I fix this.. what is WKSYS is it part of apex?

  • How do I get my 4s to sleep when not in use?

    My iTunes wasn't being recognized but after I figured out how to fix the problem, the phone doesn't turn black after a minute or less...please help!  Thanks a bunch!

  • Workbook issue

    I opened a workbook in BEx Analyzer ,changed something in the workbook. Now the issue is when I click "save workbook" it does not prompt me to a transport. Do you know why  ?. My requiremnet is I need to put the workbook changes into a transport. Tha

  • Restore7.exe application error

    So, when I try to start my windows, an error box pop up, which says: "Restore7.exe - Application error. The instruction at 0x77892591 referenced memory at 0x00008084. The memory could not be read." when clicking OK, computer starts over and get stuck