2010 Jan 04 11:52 AM
hi frends, in our import PO the PO amount is nt converted correctly to the words. For e.g : $ 4340.91
it is reading as "US DOLLAR four thousnad three hundered forty and nine thousand one hundered cents only "
the code in the smartforms is ok :
clear : W_T685T.
*data :l_effective like komv-kwert.
clear : l_effective.
loop at IT_T685T into W_T685T.
l_effective = l_effective + W_T685T-kwert.
endloop.
data : amount type P DECIMALS 4.
amount = l_effective.
if ZXEKKO-waers = 'INR'.
CALL FUNCTION 'HR_IN_CHG_INR_WRDS'
EXPORTING
AMT_IN_NUM = amount
IMPORTING
AMT_IN_WORDS = in_words-word
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2.
*increased length from 9 to 10
CALL FUNCTION 'ZMMF_HR_IN_CHG_INR_WRDS'
EXPORTING
AMT_IN_NUM = amount
IMPORTING
AMT_IN_WORDS = in_words-word
EXCEPTIONS
DATA_TYPE_MISMATCH = 1
OTHERS = 2.
*end
else.
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = amount
CURRENCY = ZXEKKO-waers
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = in_words
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
endif.
select single * from TCURT into wa_tcurt where spras = sy-langu and WAERS =
ZXEKKO-waers.
condense in_words-word.
condense in_words-decword.
if ZXEKKO-waers <> 'INR'.
translate in_words-word to lower case.
translate in_words-decword to lower case.
translate in_words-word(1) to upper case.
concatenate wa_tcurt-ktext in_words-word 'and' in_words-decword 'only'
into in_words-word
separated by space.
find substring 'cents' in in_words-word.
if sy-subrc = 0.
replace substring 'cents' in in_words-word with space.
endif.
find substring 'only' in in_words-word.
if sy-subrc = 0.
replace substring 'only' in in_words-word with space.
endif.
concatenate in_words-word 'cents' 'only'
into in_words-word
separated by space.
else.
find substring 'Paise' in in_words-word.
if sy-subrc = 0.
replace substring 'Rupees' in in_words-word with 'and'.
else.
replace substring 'Rupees' in in_words-word with space.
endif.
translate in_words-word to lower case.
translate in_words-word+0(1) to upper case.
concatenate 'Rupees' in_words-word 'only' into in_words-word separated
by space.
endif.plz help!!
2010 Jan 05 3:27 AM
Hi ,
Declare
data : amount type P DECIMALS 2.
Hope this resolves your issue.
Hi ,
Declare
data : amount type P DECIMALS 2.
Hope this resolves your issue.
2010 Jan 04 12:12 PM
Hi,
The problem is with your definition of the variable amount. You've defined it as
data : amount type P DECIMALS 4.
which means what you're actually passing to SPELL_AMOUNT is $ 4340.9100
Regards,
Nick
2010 Jan 05 3:27 AM
Hi ,
Declare
data : amount type P DECIMALS 2.
Hope this resolves your issue.
2010 Jan 05 5:00 AM
Hi harsh thnx for help dear.But frend i hav already tried it. when i changed decimal 4 to 2 then the output for the same amount became :
*"US DOLLAR Forty three and four thousand ninety one cents only"*
2010 Jan 05 11:16 AM
Hi,
Having changed your code to define the amount variable as DEC 2 you need to debug the call of the function module SPELL_AMOUNT. If you are getting 'Forty three and four thousand ninety one cents' back then you are now most likely passing 43.4091 to the FM.
The problem is with the definition of the variables l_effective, W_T685T-kwert and amount. Debug the code that adds W_T685T-kwert to l_effective then moves it to amount, check the values to determine where the decimal places are being moved and change the definition of the variables to make this work.
Regards,
Nick
2010 Jan 05 6:08 AM
HI,
USe this HR_IN_CHG_INR_WRDS replace rupees with dollars and Paise with cents.
Regards
2010 Jan 05 6:37 AM
where to replace rupee with dollars and paise with cents....Plz elaborate ur answer I am just a beginner for ABAP
2010 Jan 05 8:59 AM
have a look into the code of ABAP report RF_SPELL
you can execute it, it is a test program.
the write statements give you exact what you want, of course with 2 decimals
so you only need to add your Dollar and Cent words
2010 Jan 05 10:31 AM
thnx frend , i have tried it but that report is reading it as :
FOUR THOUSAND THREE HUNDRED FORTY
NINE THOUSAND ONE HUNDRED
2010 Jan 05 12:13 PM
>
> thnx frend , i have tried it but that report is reading it as :
>
>
>
FOUR THOUSAND THREE HUNDRED FORTY > > NINE THOUSAND ONE HUNDRED
you get this nonsense because you submitted this: 4340.9100
I said you have to use 2 decimals: 4340.91
2010 Jan 05 12:19 PM
Hi harsh thnx for help dear.But frend i hav already tried it. when i changed decimal 4 to 2 then the output for the same amount became :
*"US DOLLAR Forty three and four thousand ninety one cents only"*i have already tried the case......but its nt working...also i have already specified that i have tried for 2 instad of 4 but it is not working.
2010 Jan 05 1:09 PM
if that is the case, then this sample program from SAP must be wrong in your system. In that case you should open an incident at SAP.
But try it again.
I'll gibe you what I enter and what I receive
i enter:
keep your attention to the decimal notation, because we in Germany use the comma to seperate the decimals. (maybe this is causing your problem)
Langugae EN
Currency USD
Amount 4.340,91
Filler
I get:
4.340,91 USD
ZERO ZERO ZERO ZERO ZERO ZERO ZERO ZERO
ZERO ZERO ZERO FOUR THREE FOUR ZERO
FOUR THOUSAND THREE HUNDRED FORTY
NINETY-ONE
000000000004340 910
And here you just need to concatenate the field that holds "FOUR THOUSAND THREE HUNDRED FORTY " with dollar and the field that has "NINETY-ONE " with cent.
to get it into the form you want.
2010 Jan 06 6:33 AM
thnx frend, it may be the problem.but when i tried the hard core value the i t is giving runtime error.
what i had one is that passed the value as you specified that is with comma.Then obvious runtime error occured
" Unable to interpret "4.340,91" as a number."what should i do.
2010 Jan 06 8:25 AM
just to be able to try it with 4.340,91 you can exchange the decimal format in your user setting in SU3 transaction.
However, if you keep your user setting as is, then you have to enter 4,340.91
and you should get the same result as I got, otherwise it is really an error in the program
2010 Jan 07 8:12 AM
HI
use FM HR_IN_CHG_INR_WRDS if u give input 4340.91
u will get FOUR THOUSAND THREE HUNDRED FORTY Rupees NINETY ONE Paise
in this
replace all occurances of 'Rupees' with dollars.
replace all occurances of 'paise' with cents.
2010 Jan 07 8:38 AM
hey man....thois would be true for amount in thousands only.....when i will increase the amount then it would convert it in indian format not in the format for reading US Dollars
2010 Jan 07 9:31 AM
HI
use spell_amount FM in this following way.
try this
data lv_words(100)
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING\
AMOUNT = '4340.91'
CURRENCY = ' USD'
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS =wa_amt.
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3
CONCATENATE wa_amt-words 'DOLLARS' wa_amt-decword 'Cents' INto lv_words seprated by space.
Regards
2010 Jan 07 9:42 AM
Hi,
see ZXEKKO-waers data in debugging mode. It should have value if the value is blank then u will get the problem you said .is shd not be blank at any time.
This is working fine for me
Regards
R
2010 Jan 07 10:14 AM
friend how to use the debug mode.I am just a beginner.I have tried using smartform_trace but getting nothing usefull.Plz help me if i wanna check the value of ZXEKKO-waers in debug mode.
2010 Jan 07 10:21 AM
Hi,
The problem is not with WAERS it is with variables l_effective, W_T685T-kwert and amount, but you still need to debug to find where it is setting the incorrect number of decimals in the value. This simplest way to start the debug (if this code is called from a smartform) is to set a break point.
If you need to know generally how to debug ask an experienced colleague or search this forum and the internet in general for beginners guides.
Regards,
Nick
2010 Jan 07 10:23 AM
hey frend i got the value in debugging mode :
what i have done is.I placed "break-point" after FM of SPELL _AMOUNT and then press f8 to execute when i gt into the debugg mode i double clicked on the ZXEKKO-waers and the value showed in the window right of it is :
"00200020002000200020"abve value was shown for ZXEKKO-waers under hexadecimal value and value for amount is
"000000000000000C"this time i am using definition as
amount type p decimals 4i hav also checked the value for "l-effective" :
000000000000000Cbut one thing i noticed is that the technical type for the L-effective is
" P(7) DECIMALS 2 "the value for "W_T685T-KWERT" is laos same and the technical type of it is also same as that of L-effective
Edited by: achalmehra on Jan 7, 2010 11:30 AM
2010 Jan 07 10:42 AM
2010 Jan 08 10:16 AM
the value for the ZXEKKO-waers is not sidpalyed in the debugging mode only the hexadecimal value is being displayed
2010 Jan 11 12:11 PM
a purchase order cannot be without currency.
Check in ME23N if your document is really a PO (maybe it is just a request for quotation), and if there is a currency at header level in tab delivery/invoice.
This currency is either coming from vendor master or from your own company code customizing.
2010 Jan 11 12:16 PM
yes friend i have checked that.It is a import PO and there is also currency key in the heder as expected but i dont know why in print preview we are facing this problem
2010 Jan 11 12:22 PM
I personally do not trust the print preview in SAP. Print it to be certain.
debug your program to see when ZXEKKO-waers is updated and why it is different to EKKO-WAERS
you might call the function module to early or missed to update the ZXEKKO-waers
2010 Feb 22 7:13 AM
hi jurgen,
i have passed hard core value to spell_amount like :
CALL FUNCTION 'SPELL_AMOUNT'
EXPORTING
AMOUNT = '4310551.70' "changed amount to var
CURRENCY = ZXEKKO-waers
LANGUAGE = SY-LANGU
IMPORTING
IN_WORDS = in_words
EXCEPTIONS
NOT_FOUND = 1
TOO_LARGE = 2
OTHERS = 3.
endif.
select single * from TCURT into wa_tcurt where spras = sy-langu and WAERS =
ZXEKKO-waers.
condense in_words-word.
condense in_words-decword.
if ZXEKKO-waers <> 'INR'.
translate in_words-word to lower case.
translate in_words-decword to lower case.
translate in_words-word(1) to upper case.
concatenate wa_tcurt-ktext in_words-word 'and' in_words-decword 'only'
into in_words-word
separated by space.
find substring 'cents' in in_words-word.
if sy-subrc = 0.
replace substring 'cents' in in_words-word with space.
endif.
find substring 'only' in in_words-word.
if sy-subrc = 0.
replace substring 'only' in in_words-word with space.
endif.
concatenate in_words-word 'cents' 'only'
into in_words-word
separated by space.
* translate in_words-word to upper case.
* translate in_words-word to lower case.
* translate in_words-word(1) to upper case.
else.
find substring 'Paise' in in_words-word.
if sy-subrc = 0.
replace substring 'Rupees' in in_words-word with 'and'.
else.
replace substring 'Rupees' in in_words-word with space.
endif.
translate in_words-word to lower case.
translate in_words-word+0(1) to upper case.
concatenate 'Rupees' in_words-word 'only' into in_words-word separated
by space.
* translate in_words-word to lower case.
* translate in_words-word(1) to upper case.
endif.still the o/p is : US DOLAR FORTY THRE THOUSAND ONE HUNDERED AND FIVE THOUSAND ONE HUNDERED SEVENTY CENTS ONY
2010 Jan 05 11:22 AM
Hi
You can just use FM SPELL_AMOUNT, pass the amount and use the output WORD and DECWORD of IN_WORDS structure to build your amount in words.
IF you pass your amount of $4340.91, you will get
WORD - FOUR THOUSAND THREE HUNDRED FORTY
DECWORD- NINETY-ONE
Use: concatenate 'US Dollars' WORD 'Cents' DECWORD separated by space into lf_str.
Regards
Raj
2010 Jan 11 11:23 AM
| User | Count |
|---|---|
| 3 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |