Online Tutorials & Training Materials | STechies.com
Register Login

How to convert from one currency value to other?

15 Sep 2007 7:25 am || 0

We can Use the Following Function Module to convert from one Currency vale to other
In following function module we need to pass Foreign currency, Local Currency type_rate:Type of rate M=Average rate G=Bank buying rate B=bank selling rate

We Get Exchange rate for that day, foreign factor, Local factor.
And Foreign currency can be calculated as below mentioned in IF ENDIF

DATA: l_er TYPE tcurr-ukurs, "
l_ff TYPE tcurr-ffact,
l_lf TYPE tcurr-tfact,
l_erate(12) TYPE c,

CALL FUNCTION 'READ_EXCHANGE_RATE'
EXPORTING
date = sy-datum
foreign_currency = wa_bseg-pswsl
local_currency = c_euro
type_of_rate = 'M'
IMPORTING
exchange_rate = l_er
foreign_factor = l_ff
local_factor = l_lf
EXCEPTIONS
no_rate_found = 1
no_factors_found = 2
no_spread_found = 3
derived_2_times = 4
overflow = 5
OTHERS = 6.
IF sy-subrc = 0.
l_erate = l_er / ( l_ff / l_lf ).
wa_itab-wrbtr = wa_itab-wrbtr * l_erate.

ENDIF.