Application Development 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: 

Conversion Routine for Converting CAD to USD Currency ..

Former Member
0 Kudos

Hi ,

I want a Conversion Routine for Converting CAD to USD Currency ..

If possible give some sample codes.

Thanks,

Gokul.

2 REPLIES 2

Former Member
0 Kudos

Hi try this...

data:

w_amt like knka-KLIMG.

CALL FUNCTION 'CONVERT_TO_FOREIGN_CURRENCY'

EXPORTING

  • CLIENT = SY-MANDT

date = sy-datlo

foreign_currency = 'USD'

local_amount = '1000'

local_currency = 'CAD'

  • RATE = 0

  • TYPE_OF_RATE = 'M'

  • READ_TCURR = 'X'

IMPORTING

  • EXCHANGE_RATE =

FOREIGN_AMOUNT = w_amt

  • FOREIGN_FACTOR =

  • LOCAL_FACTOR =

  • EXCHANGE_RATEX =

  • DERIVED_RATE_TYPE =

  • FIXED_RATE =

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.

Former Member
0 Kudos

Hi

Use an FM like CONVERT_TO_FOREIGN_CURRENCY or CONVERT_TO_LOCAL_CURRENCY whichever is more relevant in your case.

Additionally please ensure that the exchnage rates are maintained in transaction OB08 or check table TCURR.. Besides you also need to ensure that the right exchange rate type is used.

Regards

Arun