Application Development and Automation Discussions
Join the discussions or start your own on all things application development, including tools and APIs, programming models, and keeping your skills sharp.
cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Converting Currency Amounts

Former Member
0 Likes
2,328

Hi all!!

I have to convert decimals currency from given amount.

I mean if I get USD the result is cents.

EUR the result is cents etc...

Thanks!!!!!

DIANA

Hi all!!

I have to convert decimals currency from given amount.

I mean if I get USD the result is cents.

EUR the result is cents etc...

Thanks!!!!!

DIANA

12 REPLIES 12
Read only

Former Member
0 Likes
1,675

Hi,

Not quite sure if I got what you need but here's an example how to convert given amount to another currency:

CALL FUNCTION 'CONVERT_AMOUNT_TO_CURRENCY' EXPORTING 
date = sy-datum 
foreign_currency = 'USD' 
foreign_amount = '2000.00' 
local_currency = 'EUR' 
IMPORTING 
local_amount = amount.

Also take a look in these Function Modules:

CURRENCY_CONVERT,

CURRENCY_CONVERT_TO_EURO,

CURRENCY_CONVERTING_FACTOR ,

CONVERT_CURRENCY_BY_RATE,

CONVERT_FOREIGN_TO_FOREIGN_CUR

Hope it helps,

Ville

Read only

Vinod_Chandran
Active Contributor
0 Likes
1,675

Hi,

If I understood your requirement correctly you want to convert the decimal part of the amount. If the amount is 123.45, you want to convert 45 as well. For this pls use the function module SPELL_AMOUNT. The import parameter IN_WORDS-DECWORD will give this.

Cheers

Vinod

Read only

0 Likes
1,675

No

You didn't get what I need...I'll try to explain more clear..

I have to convert currency in decimal places but not the amount itself (for getting the amount I'm using FM SPELL_AMOUNT ) For example I have to get THE WORD "cents" in case of input USD...

INPUT: USD

OUTPUT: CENTS

Read only

0 Likes
1,675

Hi

Perhaps I've not understood your problem, but if you wanto the amount in cent why do multiple the amount for 100?

AMOUNT = 100,12 USD => AMOUNT = 10012 CENT

Now call fm SPELL_AMOUNT for 10012

Max

Read only

0 Likes
1,675

NO NO NO

I don't need the amount at all!

I need THE WORD "CENTS" when I got currency EQ USD(for example).

I mean giving the currency(USD/EUR/RUBL(RUS)/LIRA/SHEKEL) I need to get the "cents" of it.(NOT THE AMOUNT)

Read only

0 Likes
1,675

Ok

I think the word 'CENTS' there isn't in SAP, but you can check if your currency can have two decimals (so it manages the cents) in the table TCURX.

If there isn't in TCURX, it means the currency supports two decimal, if there is you have to see the field CURRDEC to know how many decimals the currency can have.

After you can use FM SPELL_AMOUNT to obtein the decimal part in words.

TABLES SPELL.

DATA: CURRENCY LIKE SY-WAERS VALUE 'USD'.

DATA: AMOUNT TYPE WRBTR.

MOVE '1234.14' TO AMOUNT.

SELECT SINGLE CURRKEY FROM TCURX INTO CURRENCY

WHERE CURRKEY EQ CURRENCY.

CHECK SY-SUBRC <> 0.

CALL FUNCTION 'SPELL_AMOUNT'

EXPORTING

AMOUNT = AMOUNT

CURRENCY = CURRENCY

FILLER = ' '

LANGUAGE = SY-LANGU

IMPORTING

IN_WORDS = SPELL

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.

WRITE: SPELL-WORD, CURRENCY, 'and', SPELL-DECWORD, 'CENTS'.

Max

Read only

0 Likes
1,675

Yes, But I need not only "cents"

I need FOR ANY CURRENCY!

FOR EXAMPLE: If I have LIRA as INPUT the OUTPUT is "centesimo" (in ITALY)

Read only

0 Likes
1,675

I believe you shoud create a custom table with translate of word CENT.

I think this table should have the client and language as key fields, perhaps currency too:

The Euro is currency used by many European Country, so you can need several translates of word CENT for the same currency.

Max

Read only

0 Likes
1,675

I think there is a SAP standard table and a FM for this...

Read only

0 Likes
1,675

If there is it, it could be in T015Z or TCURT, otherwise...good luck

Max

Message was edited by: max bianchi

Read only

0 Likes
1,675

Hi Diana,

As far as I am aware of SAP is not storing the currency denomination text. You can do two things, either keep this information in a table or hardcode if it never changes.

Cheers

Vinod

Read only

Former Member
0 Likes
1,675

Hi Diana,

I have a similar problem in my development. Can you please tell me if you found any solution within SAP or did u have to create a custom table??

Thanks!!

Bindu