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 Conversion Problem

Former Member
0 Likes
770

Hi All,

I wish to convert the amount from US$ to USD.

I am using the FM as follows ::

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

client = sy-mandt

date = sy-datum

foreign_amount = 100

foreign_currency = US$

local_currency = USD

IMPORTING

local_amount = l_curr.

The exchange rate for US$ and USD is 1.00 as maintained in the table TCURR

Thus 1 US$ = 1 USD

But I am getting the result as zero.

There is something wrong somewhere but I am not getting it.

Your suggestion would really be appretiated.

regards

6 REPLIES 6
Read only

Former Member
0 Likes
716

Hi Sachin,

You are most probably giving the date wromg, just check the TCURR entry once again and find the value of GDATU.Pass that date in the date parameter of the FM and it should work fine.

Thanks,

Imran

Read only

0 Likes
716

Still the same problem. I have tried it.

Read only

Former Member
0 Likes
716

Hi,

Check this example

DATA: v_amount TYPE p DECIMALS 2.

CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'

EXPORTING

date = sy-datum

foreign_currency = 'INR'

local_amount = '1.00'

local_currency = 'USD'

IMPORTING

foreign_amount = v_amount

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.

WRITE: / 'US dollar to Indian rupees - ', v_amount.

ENDIF.

Cheers

Alfred

Read only

Former Member
0 Likes
716

Hello,

Check this sample:


  DATA : L_NETWR TYPE VBAP-NETWR.
        CLEAR : L_NETWR.
        CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
             EXPORTING
                  DATE             = SY-DATUM
                  FOREIGN_AMOUNT   = G_T_VBAP-NETWR
                  FOREIGN_CURRENCY = G_T_VBAP-WAERK
                  LOCAL_CURRENCY   = G_T_VBAK-WAERS
             IMPORTING
                  LOCAL_AMOUNT     = L_NETWR
             EXCEPTIONS
                  NO_RATE_FOUND    = 1
                  OVERFLOW         = 2
                  NO_FACTORS_FOUND = 3
                  NO_SPREAD_FOUND  = 4
                  DERIVED_2_TIMES  = 5
                  OTHERS           = 6.

Provided the exchange rates should be maintained properly.

Vasanth

Read only

Former Member
0 Likes
716

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'

EXPORTING

client = sy-mandt

date = sy-datum

You are giving the value sy-datum , are you sure that as of today the exchange rates are updated