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

Getting currency conversion rate

Former Member
0 Likes
420

Hi,

I need to convert any non-USD currency amount to USD. I know that the rates are stored in the table TCURR. I want to know how do i get the today's currency rate from this table. Exchange rate type I'll be using is M.

Thanks,

Prasy

1 ACCEPTED SOLUTION
Read only

Former Member
0 Likes
382

Hi,

For table TCURR, you can change the currency for the nearest date compared to current day.

But for using the FM: CONVERT_TO_LOCAL_CURRENCY,you can change the currency for the current day if you filled in the date below. You can have a try.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
  EXPORTING
*   CLIENT                  = SY-MANDT
    *date                    = sy_datum*    
    foreign_amount          =  '1000'
    foreign_currency        = 'USD'
    local_currency          = 'EUR'
*   RATE                    = 0
*   TYPE_OF_RATE            = 'M'
*   READ_TCURR              = 'X'
* IMPORTING
*   EXCHANGE_RATE           =
*   FOREIGN_FACTOR          =
*   LOCAL_AMOUNT            =
*   LOCAL_FACTOR            =
*   EXCHANGE_RATEX          =
*   FIXED_RATE              =
*   DERIVED_RATE_TYPE       =
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Hope it is useful.

Regards,

Chris Gu

2 REPLIES 2
Read only

Former Member
0 Likes
382

Hi,

You can use function module 'CONVERT_TO_LOCAL_CURRENCY'.

Jamie

Read only

Former Member
0 Likes
383

Hi,

For table TCURR, you can change the currency for the nearest date compared to current day.

But for using the FM: CONVERT_TO_LOCAL_CURRENCY,you can change the currency for the current day if you filled in the date below. You can have a try.

CALL FUNCTION 'CONVERT_TO_LOCAL_CURRENCY'
  EXPORTING
*   CLIENT                  = SY-MANDT
    *date                    = sy_datum*    
    foreign_amount          =  '1000'
    foreign_currency        = 'USD'
    local_currency          = 'EUR'
*   RATE                    = 0
*   TYPE_OF_RATE            = 'M'
*   READ_TCURR              = 'X'
* IMPORTING
*   EXCHANGE_RATE           =
*   FOREIGN_FACTOR          =
*   LOCAL_AMOUNT            =
*   LOCAL_FACTOR            =
*   EXCHANGE_RATEX          =
*   FIXED_RATE              =
*   DERIVED_RATE_TYPE       =
* 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.
* MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
*         WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
ENDIF.

Hope it is useful.

Regards,

Chris Gu