‎2010 Apr 29 12:02 PM
There is a function that converts an amount in accordance with WAERS input.
example
amount 100234
input waers with 2 decimal
output 1002,34
amount 1002,34
input waers with 3 decimal
output 100,234
Edited by: francesco aiello on Apr 29, 2010 1:10 PM
‎2010 Apr 29 12:14 PM
Hi francesco,
if anyway you catch the number of decimal places inot a number through string manipulation,
say you get the number of decimal places as n,
what you can do is,
divisor = '1'.
amount = '10094'.
do n times. " say 2
divisor = divisor * 10.
enddo.
** now your divisor becomes 100!
now divide your amount--
amount = amount / divisor. " now amount = 10094 / 100 = 100.94Just a suggestion, you may have more efficient ways to do it.Sumit
‎2010 Apr 29 12:14 PM
Hi francesco,
if anyway you catch the number of decimal places inot a number through string manipulation,
say you get the number of decimal places as n,
what you can do is,
divisor = '1'.
amount = '10094'.
do n times. " say 2
divisor = divisor * 10.
enddo.
** now your divisor becomes 100!
now divide your amount--
amount = amount / divisor. " now amount = 10094 / 100 = 100.94Just a suggestion, you may have more efficient ways to do it.Sumit
‎2010 Apr 29 12:19 PM
You have to use the BAPI: BAPI_CURRENCY_GETDECIMALS to get how many decimals are defined for the currency
Edited by: Suhas Saha on Apr 29, 2010 4:53 PM:
If it is a report output or a form you have to use the Reference Currency field. It will automatically format your output based on the currency code. Else you have the BAPI_CURRENCY_CONV_TO_EXTERNAL to convert to external format.
‎2010 Apr 29 12:20 PM
Hi,
There are two FM that can help you:
1. BAPI_CURRENCY_CONV_TO_EXTERNAL : This converts currency amounts from SAP internal data formats into external data formats.
2.BAPI_CURRENCY_CONV_TO_INTERNAL : This converts currency amounts from SAP external data formats into internal data formats.
Regards,
Sana.
‎2010 Apr 29 12:22 PM
Hi
How about as follows.
WRITE int CURRENCY 'USD'.
USD has 2 decimal
Regards,
Gaito