‎2010 Oct 05 4:12 PM
i m using the function module spell_amount. but when i m passing the amount field say value 900,000.12, then the output comin is 'RUPEES NINE HUNDRED THOUSAND AND ZERO PAISA ONLY', which is not correct in my sceneario. i want it to be nine lakh and twelve paise only.
how it could be and what changes i have to make ?
‎2010 Oct 05 4:18 PM
Hi,
Use Function module HR_IN_CHG_INR_WRDS, it will surely resolve your problem.
Edited by: UMANGmehta on Oct 5, 2010 5:19 PM
‎2010 Oct 05 6:56 PM
but i am not able to get the decimal value as paise.
it only shows the rupee not paise(decimal value).
what i need to do for that?
‎2010 Oct 06 8:12 AM
Example
TABLES : vbak.
data :
CTOTTEXT type c.
PARAMETER : ncurr(15) type c.
DATA :nsignamt like reguh-rwbtr,
nLentotake type i,
actualstrlen type i,
flen TYPE i,
nStrt type i,
nPos type i,
nIntEndsAt type i,
decpos type i.
DATA : cFullText(254) type c,
cstring(18) type c,
cIntstring(15) type c,
cPart(2) type c,
c1stdigit(1) type c,
c2nddigit(1) type c,
cDecstring(2) type c,
cTextpos(10) type c,
ctext like T015Z-WORT.
cFullText = ''.
move ncurr to cString.
REPLACE '-' WITH ' ' INTO CSTRING.
REPLACE ',' WITH ' ' INTO CSTRING.
REPLACE ',' WITH ' ' INTO CSTRING.
condense cSTring NO-GAPS .
fLEN = STRLEN( cString ). "gives correct length
decpos = flen - 2.
nIntEndsAt = flen - 3.
*split currency string into integer part and decimal part.
* move cString+0( nIntendsat ) to cIntString.
cIntstring = cString+0(nIntendsat).
move cString+decpos(2) to cDecString.
* TAKE 2 TIMES AS ONCE FOR INTEGER 2NDLY FOR DECIMAL
do 2 times.
* whichver part of the amount (int or dec) u want to process put it
* in cstring.
if sy-index = 1.
move cIntString to cString .
else. " for paise part.
if cDecstring = '00'.
EXIT.
endif.
CONCATENATE cFullText 'AND PAISE' INTO cFullText SEPARATED BY
SPACE.
move cDecString to cString .
endif.
fLEN = STRLEN( cString ). "gives correct length
nStrt = 0.
nLentotake = 1.
DO 10 times.
CASE flen.
WHEN 3. "hundreth position.
nLentotake = 1.
WHEN 9 or 7 or 5 or 2.
nLentotake = 2.
WHEN 8 or 6 or 4 or 1.
nLentotake = 1.
ENDCASE.
‎2010 Oct 06 8:12 AM
Continue..........
cpart = ''.
** take 1 or 2 digits for lakhs, thousand
move cstring+nStrt(nLentotake) to cPart .
** bring text description as per cpart.
IF nLenTotake = 1.
c1stdigit = '0'.
c2nddigit = cPart+0(1).
ELSE.
c1stdigit = cPart+0(1).
c2nddigit = cPart+1(1).
ENDIF.
** if pair of digit is 00 then make the cText and cTextpos blank.
IF ( nLentotake = 1 and c2nddigit = '0' ) or ( nLentotake = 2 and
cPart = '00' ).
cText = '' .
cTextPos = ''.
ELSE.
SELECT SINGLE WORT FROM T015Z INTO ctext WHERE spras = 'E' AND EINH
= c1stdigit and ZIFF = c2nddigit .
** now decide place indicator
CASE flen. "NPOS.
WHEN 8 OR 9.
CTEXTPOS = 'CRORE'.
WHEN 6 OR 7.
CTEXTPOS = 'LAC'.
WHEN 4 OR 5.
CTEXTPOS = 'THOUSAND'.
WHEN 3.
CTEXTPOS = 'HUNDRED'.
WHEN OTHERS.
CTEXTPOS = ''.
ENDCASE.
ENDIF.
* cText contains ; so replace it with space.
REPLACE ';' WITH ' ' INTO cText.
** add digit description and place indicator.
CONCATENATE cFullText cText cTextPOS INTO cFullText SEPARATED BY
SPACE
.
** decide place & lenght for next loop.
flen = flen - nLentotake.
* check if string is over.
if flen = 0.
exit.
endif.
nStrt = nSTrt + nLenTotake.
ENDDO.
ENDDO.
CONCATENATE cFullText 'ONLY' INTO cFullText SEPARATED BY SPACE.
break developer.
move cFulltext+1 to cTottext.
break developer.
* write : / ncurr, cTottext.
‎2010 Oct 06 4:19 PM
Hi,
HR_IN_CHG_INR_WRDS function module giving velue in words upto 2 decimals, please check.
EG. if 12,345.78 is the value then
output
TWELVE THOUSAND THREE HUNDRED FORTY FIVE Rupees SEVENTY EIGHT Paise
Edited by: UMANGmehta on Oct 6, 2010 5:20 PM
‎2010 Oct 11 3:27 PM