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.
Similar Messages
-
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. -
Print Layout : Amount in Words
Hai To All,
I customize print layout of A/P Invoice on that i have some problem:
1) there iam calculating total amount.At the bottom of my page that amount should display in words.How to do that???
2) In between repetitive Area and End of Report there is no border while taking print its not looking good.
Anyone have idea about this????
Regards,
AnithaHi Ani,
For 1st question:
1. select the that field. goto Properties
2. In General Tab u can find Link to Textbox
3. In that textbox select the field-id of the Total Amount
4. Now goto Format tab, select the Amount in words check box
This is the way u can print Amount in words.
For 2nd Question:
1. select the repetitive area in Field Index window
2. Now goto Properties Window, select the Border Tab
3. there, in low textbox, put 1.
Thanks,
Suresh Yerra -
Wrong Conversion of Amount in Words in Purchase Order print out
Hi,
Please help me with the problem in printing of Purchase Order, there is an error in amount in words. For example the total amount in numbers is 93,311.30 however the amount in words will be nine million three hundred thirty-one thousand one hundred thirty.As per my understanding the amount in number was multiply by 100. Please help what i should check.
Thanks,
RichardDear,
Take the help of the ABAPER guy and check what he written in the program of the PO layout & printout.
http://help.sap.com/printdocu/core/print46c/en/data/pdf/BCSRVSCRSF/BCSRVSCRSF.pdf
This will solve your problem
Thanks & regards.
Varun Bisaria
Edited by: Varun Bisaria on Oct 21, 2011 2:10 PM -
Check printing: Amount in words is getting jumbled
Hi,
I have a problem in displaying amount in words in check.
I am getting the amount in words through functuion module SPELL_AMOUNT correctly,i.e,(for example,110,002 ) ONE HUNDRED TEN THOUSAND TWO.
After getting the amount,i am concatenating the words 'ONLY' amount 'RIYALS'.In program it is concatenated correctly.Expected output is RIYALS ONE HUNDRED TEN THOUSAND ONLY.
But when seen on screen,the words are getting jumbled.
It is getting displayed as TWO RIYALS ONLY ONE HUNDRED TEN THOUSAND.
(Note: My form is in arabic,since i want to display vendor name in arabic,and rest of the check in english).
Please help me with some solution.
Thanks & Regards
Seshagiri.Hi Dishant,
Sorry for the delay.I am pasting the code below:
Code in print program:
Global data:
data: gv_riyals(6) value 'RIYALS', "RIYALS
gv_only(4) value 'ONLY',
gv_halalas(7) value 'HALALAS',
gv_and(3) value 'AND'.
Local data:
data: lw_dummy(25),
lw_fraction(2), "for fraction part of amount in HALALAS
lw_integer type i.
if spell-decimal is initial.
clear: spell-decimal, dg_100.
else.
lw_integer = spell-decimal / 10.
lw_fraction = lw_integer.
concatenate '(' lw_fraction '/100)'
into lw_dummy. " SEPARATED BY space.
condense lw_dummy.
clear dg_100.
dg_100 = lw_dummy.
if not spell-word is initial.
condense spell-word.
gv_spell_word(50) = spell-word. "Amount in RIYALS
endif.
endif.
call function 'WRITE_FORM'
exporting
window = 'PAY_DOC'
element = 'PAY_DOC'
exceptions
window = 1
element = 2.
if sy-subrc eq 2 and
( err_element-fname ne t042e-zforn
or err_element-fenst ne 'PAY_DOC'
or err_element-elemt ne 'PAY_DOC' ).
err_element-fname = t042e-zforn.
err_element-fenst = 'PAY_DOC'.
err_element-elemt = 'PAY_DOC'.
err_element-text = text_530.
*--Code in the script:
/: IF &DG_100& EQ ' '
L1 &gv_only(C)&,,&gv_riyals(C)&,,&spell-word&
/: ELSE
L1 &gv_riyals(C)&,,&gv_spell_word(C)&
L1 &gv_only(C)&,,&gv_halalas(C)&,,&dg_100(C)&,,&gv_and(C)&
/: ENDIF
Thanks & Regards
Seshagiri. -
How to display amount in words in the last page
Hi,
I am very new to Oracle Report, but v.good experience in Crystal report.
How can i display amount in words for an invoice amount total in the last page of the invoice and after total amount. I created a new non repeating frame and put the amount in words inside that, and set the frames diplay property Print on Last Page, but the problem is already there is a repeating frame to print all the invoices item, and the total in figure. But the amount in words frame is not always coming after the total amount,either it should be at the bottom of the last page in fixed position, otherwise it should move just below the total amount.
I am using Oracle 11g.
Thanks in advance...
FslHi ,
Use This function
create or replace FUNCTION xxg4_zen_conv_words (p_amount IN Number) RETURN Varchar2 IS
--Creation Date : 11-DEC-2009
--Purpose : This Function returns amount in words.
--Parameters :
--1) p_amount : Only positive and negative values are allowed.
Precision can be entered upto 10 digits and only 2 scales
are allowed e.g 9999999999.99
-- Index by Tables to store word list
TYPE typ_word_list IS TABLE OF Varchar2(200) INDEX BY BINARY_INTEGER;
t_typ_word_list typ_word_list;
TYPE typ_word_gap IS TABLE OF Varchar2(200) INDEX BY BINARY_INTEGER;
t_typ_word_gap typ_word_gap;
-- Local Variables
v_amount Number := p_amount;
v_amount_length Number;
v_words Varchar2(10000);
v_point_found Varchar2(1) := 'N';
v_point_value Number;
BEGIN
/*Getting value after point if found */
v_point_value := SUBSTR(v_amount,(INSTR(v_amount,'.',1) + 1),2);
/*Checking whether amount has any scale value also */
v_point_found := CASE WHEN (INSTR(v_amount,'.',1)) = 0 THEN 'N'
WHEN (INSTR(v_amount,'.',1)) > 0 THEN 'Y'
END;
/*Converting amount into pure numeric format */
v_amount := FLOOR(ABS(v_amount));
v_amount_length := LENGTH(v_amount);
t_typ_word_gap(2) := 'and Paise';
t_typ_word_gap(3) := 'Hundred';
t_typ_word_gap(4) := 'Thousand';
t_typ_word_gap(6) := 'Lakh';
t_typ_word_gap(8) := 'Crore';
t_typ_word_gap(10) := 'Arab';
FOR i IN 1..99
LOOP
t_typ_word_list(i) := To_Char(To_Date(i,'J'),'Jsp');
END LOOP;
IF v_amount_length <= 2
THEN
/* Conversion 1 to 99 digits */
v_words := t_typ_word_list(v_amount);
ELSIF v_amount_length = 3
THEN
/* Conversion for 3 digits till 999 */
v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(3);
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,2));
ELSIF v_amount_length = 4
THEN
/* Conversion for 4 digits till 9999 */
v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(4);
IF SUBSTR(v_amount,2,1) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,1))||' '||t_typ_word_gap(3);
END IF;
IF SUBSTR(v_amount,3,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,3,2));
END IF;
ELSIF v_amount_length = 5
THEN
/* Conversion for 5 digits till 99999 */
v_words := t_typ_word_list(SUBSTR(v_amount,1,2))||' '||t_typ_word_gap(4);
IF SUBSTR(v_amount,3,1) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,3,1))||' '||t_typ_word_gap(3);
END IF;
IF SUBSTR(v_amount,4,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,4,2));
END IF;
ELSIF v_amount_length = 6
THEN
/* Conversion for 6 digits till 999999 */
v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(6);
IF SUBSTR(v_amount,2,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,2))||' '||t_typ_word_gap(4);
END IF;
IF SUBSTR(v_amount,4,1) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,4,1))||' '||t_typ_word_gap(3);
END IF;
IF SUBSTR(v_amount,5,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,5,2));
END IF;
ELSIF v_amount_length = 7
THEN
/* Conversion for 7 digits till 9999999 */
v_words := t_typ_word_list(SUBSTR(v_amount,1,2))||' '||t_typ_word_gap(6);
IF SUBSTR(v_amount,3,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,3,2))||' '||t_typ_word_gap(4);
END IF;
IF SUBSTR(v_amount,5,1) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,5,1))||' '||t_typ_word_gap(3);
END IF;
IF SUBSTR(v_amount,6,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,6,2));
END IF;
ELSIF v_amount_length = 8
THEN
/* Conversion for 8 digits till 99999999 */
v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(8);
IF SUBSTR(v_amount,2,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,2))||' '||t_typ_word_gap(6);
END IF;
IF SUBSTR(v_amount,4,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,4,2))||' '||t_typ_word_gap(4);
END IF;
IF SUBSTR(v_amount,6,1) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,6,1))||' '||t_typ_word_gap(3);
END IF;
IF SUBSTR(v_amount,7,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,7,2));
END IF;
ELSIF v_amount_length = 9
THEN
/* Conversion for 9 digits till 999999999 */
v_words := t_typ_word_list(SUBSTR(v_amount,1,2))||' '||t_typ_word_gap(8);
IF SUBSTR(v_amount,3,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,3,2))||' '||t_typ_word_gap(6);
END IF;
IF SUBSTR(v_amount,5,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,5,2))||' '||t_typ_word_gap(4);
END IF;
IF SUBSTR(v_amount,7,1) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,7,1))||' '||t_typ_word_gap(3);
END IF;
IF SUBSTR(v_amount,8,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,8,2));
END IF;
ELSIF v_amount_length = 10
THEN
/* Conversion for 10 digits till 9999999999 */
v_words := t_typ_word_list(SUBSTR(v_amount,1,1))||' '||t_typ_word_gap(10);
IF SUBSTR(v_amount,2,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,2,2))||' '||t_typ_word_gap(8);
END IF;
IF SUBSTR(v_amount,4,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,4,2))||' '||t_typ_word_gap(6);
END IF;
IF SUBSTR(v_amount,6,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,6,2))||' '||t_typ_word_gap(4);
END IF;
IF SUBSTR(v_amount,8,1) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,8,1))||' '||t_typ_word_gap(3);
END IF;
IF SUBSTR(v_amount,9,2) != 0
THEN
v_words := v_words ||' '||t_typ_word_list(SUBSTR(v_amount,9,2));
END IF;
END IF;
IF v_point_found = 'Y'
THEN
IF v_point_value != 0
THEN
v_words := v_words||' '||t_typ_word_gap(2)||' '||t_typ_word_list(CASE WHEN LENGTH(SUBSTR(p_amount,(INSTR(p_amount,'.',1) + 1),2)) = 1 THEN SUBSTR(p_amount,(INSTR(p_amount,'.',1) + 1),2)||'0'
WHEN LENGTH(SUBSTR(p_amount,(INSTR(p_amount,'.',1) + 1),2)) = 2 THEN SUBSTR(p_amount,(INSTR(p_amount,'.',1) + 1),2)
END);
END IF;
END IF;
IF p_amount < 0
THEN
v_words := 'Minus '||v_words;
ELSIF p_amount = 0
THEN
v_words := 'Zero';
END IF;
IF LENGTH(v_amount) > 10
THEN
v_words := 'Value larger than specified precision allowed to convert into words. Maximum 10 digits allowed for precision.';
END IF;
RETURN (v_words);
END xxg4_Zen_Conv_Words;
--Thanks
SAGAR SANKPAL -
Function to call to convert amount in words in R12
Hi Experts,
I am creating a custom report that will display invoice details. Included in the fields are AMOUNT and AMOUNT_IN_WORDS. I don't have problem for the AMOUNT field since i can retrieve it directly from the table. My concern is on the AMOUNT_IN_WORDS. Is there any function in EBS R12 which i can call directly in the SQL statement of my report to convert the AMOUNT into Words.
Thanks,
NestorHi mpautom,
What i'm looking for is a built-in function within EBS R12. Because the client doesn't allow creation of function.
Nestor -
Convert total amount into words
Hi
My requirement is to convert total amount into words.
For this i used function module SPELL_AMOUNT.
But its giving wrong (i.e. problem is in the paise).
I tried with other function module also, its not giving output.
how i can get exactly correct output.
Reward points if helpful.Hi
execute this code .
REPORT ZCOVERTION.
TABLES SPELL.
DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '23.45'.
SY-TITLE = 'SPELLING NUMBER'.
PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
WRITE: 'NUMBERS', T_SPELL-WORD ,'and', T_SPELL-DECWORD.
FORM SPELL_AMOUNT USING PWRBTR PWAERS.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = PAMOUNT
CURRENCY = PWAERS
FILLER = SPACE
LANGUAGE = 'E'
IMPORTING
IN_WORDS = T_SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
ENDFORM. " SPELL_AMOUNT
Hope this will solve ur problem
Thanks
Krushna
oputput: -
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.
SwathiHi 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 -
SAP Script(calling FM to spell the amount in words)
Hi Friends,
I am getting error in calling a function module(HR_IN_CHG_INR_WRDS : To spell the amount in words) to a script form.It is giving a dump message : "Conversion type error".
Could you guide me with small example ?
I will reward for usefull responses.
Pls. treat it as urgent.
Thx in Adv.
BobbyHi
execute this code .
REPORT ZCOVERTION.
TABLES SPELL.
DATA : T_SPELL LIKE SPELL OCCURS 0 WITH HEADER LINE.
DATA : PAMOUNT LIKE SPELL-NUMBER VALUE '23.45'.
SY-TITLE = 'SPELLING NUMBER'.
PERFORM SPELL_AMOUNT USING PAMOUNT 'USD'.
WRITE: 'NUMBERS', T_SPELL-WORD ,'and', T_SPELL-DECWORD.
FORM SPELL_AMOUNT USING PWRBTR PWAERS.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = PAMOUNT
CURRENCY = PWAERS
FILLER = SPACE
LANGUAGE = 'E'
IMPORTING
IN_WORDS = T_SPELL
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
ENDFORM. " SPELL_AMOUNT
Hope this will solve ur problem
Thanks
sreelakshmi -
Amount in Words using SPELL_Amount in Arabic Smart-forms
I am facing the difficulty during the step in smartform printing. Client is to have a printout in Bi-lingual (english+arabic), Arabic is printing fine. The maintenance language of smartform is arabic.
Problem arises:
I am using the function SPELL_AMOUNT to get the "Amount in Words" of Gross Value. In the print preview and printout, "Amount is words" are appearing as jumbled. for example,
Gross Value 238,476.00 SAR
Expected Amount in Words Two Hundred Thirty-Eight Thousand Four hundred Seventy-Six.
Appearing Amount in Words Seventy-Six Two Hundred Thirty-Eight Thousand Four Hundred.
Waiting for your valuable inputs.Hi,
Try the below code:
Pass the amount after Decimal to the Spell amount seperately and then concatenate the two parts of the amount.
For example : 30.60 USD
Store the amount in a character string. Split the string at decimal point using a SPLIT statement.
DATA: amount_total(10),
round(7),
dec_part(3).
DATA: dec(1) TYPE c VALUE '.',
amount_total = '30.69'.
SPLIT amount_total AT dec INTO round dec_part.
First pass variable 'round' to Spell_amount and then in the second call pass variable 'Dec_PART' and concatenate the two results.
Regards,
sirisha. -
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 into words in different languages
Hi All,
Is there any FM to convert the amount into words in a specific language.
SPELL_AMOUNT FM is not working for some of the languages like portuguese, etc..
Any idea on this.
Thanks in Advance.Hi,
Use the FM:
CALL FUNCTION <b>'Y_AMOUNT_IN_WORDS'</b>
Hope it helps.
Reward if helpful.
Regards,
Sipra -
Hi!
I use MS Windows XP (SP 3), MS Office 2003 (v. 11), and Acrobat 9 Professional.
I am having problems with MS Word.
First, it takes a long time to load a document. Second, when I close the document, I get a message that the system has encountered a problem and asks permission to send an error report. If I choose "Don't Send." it closes the document.
Whatever the problem is, the real problem is that is affecting other applications. I cannot use Acrobat to convert the document to a .pdf file.
Please help.
Thank you.
Doctor T.Sounds like you may have some macro in WORD causing a problem, but it appears to be a WORD problem not an Acrobat problem. For PDF creation you can print from WORD to the Adobe PDF printer. If the PDF Maker is not working and you want to go that route, open Acrobat and use Help>Repair.
-
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
KamalHi
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
Maybe you are looking for
-
Unable to create Goods Receipt for Scheduling agreement
Hi, I am have setup Scheduling agreement. When i try to create the Goods receipt on MIGO by entering the agreement #, I get an error : Purchase Order not yet released. Please help, I couldn't find similar issue reported on this forum. Thanks Ramya
-
The search feature in Add Places cannot find any locations.
When I try to add places, the search feature cannot find any locations. I can, however, drag and drop photos onto locations on the map. I've tried contacted support twice and they have not been helpful at all. I would appreciate any help.
-
MOVED: how to disable on-board graphic
This topic has been moved to MSI Notebooks & Netbooks. https://forum-en.msi.com/index.php?topic=171267.0
-
Horizontal bars with SD movies
So...I'm a new ATV (2nd gen) user. We recently moved and I'm just not a 100% sure that everything is setup the way it's supposed to be... When I rent movies on my ATV, I often have a bar at the top and bottom when viewing the movie on my HDTV (Samsun
-
Dreamweaver Templates - automation of objects
Can I make a template with objects (forgive me if wrong term) be defined once and is automatically generated for the rest of the document? Example: If I build a template with the following code: <!-- TemplateBeginEditable name="doctitle" --> <title>U