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

Currency Conversions

Former Member
0 Likes
1,044

1) Firstly i need to calculate Exchange rates for currencies SEK EUR & THB.

my question here are

a) do we need FROM currency(XYZ) while calculating exchange rates for SEK, EUR, THB ?

b) Is there any FM we can use to calc exchange rates ..or can we do it programatically ?

2) Also at one point in the prog when i get amount in some XYZ currency(which never matches with either of SEK, EUR & THB). then i need to convert this amount into 3 currencies viz (SEK, EUR & THB)

a) Again are there any FM's to do ?

b) as we get exch rates from above ...how can i use them to convert from XYZ to SEK/EUR/THB ?

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
984

Hi,

is your issue resolved... or else try this way.

DATA: l_fcurr TYPE tcurr-fcurr,

l_lcurr TYPE tcurr-tcurr,

l_exchange_rt TYPE tcurr-ukurs.

MOVE: p_local_curr TO l_lcurr,

p_foreign_curr TO l_fcurr.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

date = p_date

foreign_amount = p_foreign_amt

foreign_currency = l_fcurr

local_currency = l_lcurr

rate = 0

type_of_rate = 'M'

read_tcurr = 'X'

IMPORTING

exchange_rate = l_exchange_rt

local_amount = p_local_amt

EXCEPTIONS

no_rate_found = 1

overflow = 2

no_factors_found = 3

no_spread_found = 4

derived_2_times = 5

OTHERS = 6.

IF sy-subrc <> 0.

CLEAR p_ex_rate.

ELSE.

MOVE l_exchange_rt TO p_ex_rate.

ENDIF.

ENDFORM. " currency_conv

8 REPLIES 8
Read only

Former Member
0 Likes
984

check the FM: CONVERT_TO_FOREIGN_CURRENCY or CONVERT_TO_LOCAL_CURRENCY(whichever suits you)?

Read only

kesavadas_thekkillath
Active Contributor
0 Likes
984

You can use fm READ_EXCHANGE_RATE,

Pass type_of_rate = 'M'.

The formula goes like ,

erate = exchange_rate / ( local_factor / foreign_factor ).

Now just multiply your value with the erate.

Read only

0 Likes
984

Hi All,

When i use

DATE 20.10.2009

FOREIGN_AMOUNT 1234

FOREIGN_CURRENCY SEK

LOCAL_CURRENCY EUR

RATE 1

TYPE_OF_RATE M

READ_TCURR X

i get

DERIVED_RATE_TYPE EURX

Read only

0 Likes
984

In TCURR there must be a entry FCURR = SEK and TCURR = EUR for rate type KURST = M.

Read only

0 Likes
984

Thanks All....Closed

Read only

Former Member
0 Likes
984

Hi,

Try using the FM "HR_ECM_CONVERT_CURRENCY" or "CONVERT_CURRENCY_BY_RATE".

Regards,

Aditya

Read only

Former Member
0 Likes
985

Hi,

is your issue resolved... or else try this way.

DATA: l_fcurr TYPE tcurr-fcurr,

l_lcurr TYPE tcurr-tcurr,

l_exchange_rt TYPE tcurr-ukurs.

MOVE: p_local_curr TO l_lcurr,

p_foreign_curr TO l_fcurr.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

date = p_date

foreign_amount = p_foreign_amt

foreign_currency = l_fcurr

local_currency = l_lcurr

rate = 0

type_of_rate = 'M'

read_tcurr = 'X'

IMPORTING

exchange_rate = l_exchange_rt

local_amount = p_local_amt

EXCEPTIONS

no_rate_found = 1

overflow = 2

no_factors_found = 3

no_spread_found = 4

derived_2_times = 5

OTHERS = 6.

IF sy-subrc <> 0.

CLEAR p_ex_rate.

ELSE.

MOVE l_exchange_rt TO p_ex_rate.

ENDIF.

ENDFORM. " currency_conv

Read only

Former Member
0 Likes
984

This message was moderated.