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

exchange rate conversion

Former Member
0 Likes
779

hi , iam facing one problem.

CALL FUNCTION 'READ_EXCHANGE_RATE'

EXPORTING

client = sy-mandt

date = sy-datum

foreign_currency = 'GBP'

local_currency = 'USD'

type_of_rate = 'DB'

IMPORTING

exchange_rate = lv_ukurs

EXCEPTIONS

no_rate_found = 1

no_factors_found = 2

no_spread_found = 3

derived_2_times = 4

overflow = 5

zero_rate = 6

OTHERS = 7.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

through this FM i am getting exchange rate(lv_ukurs) as 1.96667

but in mine TCURR table it is 1.6667

WHY IS THE DIFFERENCE

hi , iam facing one problem.

CALL FUNCTION 'READ_EXCHANGE_RATE'

EXPORTING

client = sy-mandt

date = sy-datum

foreign_currency = 'GBP'

local_currency = 'USD'

type_of_rate = 'DB'

IMPORTING

exchange_rate = lv_ukurs

EXCEPTIONS

no_rate_found = 1

no_factors_found = 2

no_spread_found = 3

derived_2_times = 4

overflow = 5

zero_rate = 6

OTHERS = 7.

IF sy-subrc <> 0.

MESSAGE ID sy-msgid TYPE sy-msgty NUMBER sy-msgno

WITH sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4.

ENDIF.

through this FM i am getting exchange rate(lv_ukurs) as 1.96667

but in mine TCURR table it is 1.6667

WHY IS THE DIFFERENCE

2 REPLIES 2
Read only

matt
Active Contributor
0 Likes
733

Try running the function module in debug to find out how it's doing the calculation.

I don't know what rate type "DB" represents, but you may find it involves more in its calculation than entries in TCURR. Check also what entries you have in TCURS and TCURF. In might also be useful to know what entry you have for DB in TCURV.

matt

Read only

Former Member
0 Likes
733

Hai Anurodh,

Check this ...... may be it helps u if u missed any thing.

<b>type_rate:</b>Type of rate

<b>M=Average rate</b>

<b>G=Bank buying rate</b>

<b>B=bank selling rate</b>

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, &quot;

<b>l_ff TYPE</b> tcurr-ffact,

<b>l_lf TYPE</b> tcurr-tfact,

<b>l_erate</b>(12) TYPE c,

CALL FUNCTION 'READ_EXCHANGE_RATE'

EXPORTING

date = sy-datum

foreign_currency = wa_bseg-pswsl

local_currency =<b> c_euro</b>

type_of_rate =<b> 'M'</b>

IMPORTING

exchange_rate =<b> l_er</b>

foreign_factor =<b> l_ff</b>

local_factor = <b>l_lf</b>

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.

<b>l_erate = l_er / ( l_ff / l_lf ).</b>

<b>wa_itab-wrbtr = wa_itab-wrbtr * l_erate.</b>

ENDIF.

Debug the function module and see where the differnce is comming.

<b>reward for useful answers</b>

regards,

sunil kumar.